Question

Im kind of new in javacv and hope you can help me with a problem.

I have used rectangle recognition on an image, to find a car license plate. But what I got problem with is that I want to cut out this part of the picture and save it as an new image. How do I do this in javacv?

Thanks!

Was it helpful?

Solution

if you want to cut it (getting sub-image), you can just use this (I assume you know the basic in using )

private static CvCapture grabber;
private static IplImage temp;
private static BufferedImage buff;

...

temp = cvRetrieveFrame(grabber);
buff = temp.getBufferedImage().getSubimage(areaTop.x, areaTop.y, areaTop.width, areaTop.height);

File f  = new File ("your/filepath.jpg");
ImageIO.write(buff, "jpg", f);

if you don't want to save it and just use it directly in memory, you can try to use:

com.googlecode.javacv.cpp.opencv_core.cvSetImageROI

hope it helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top