Closed johngodoi closed 8 years ago
@saudet it is fine with me if OpenCVUtils
goes to JavaCV
. After the next release I can remove corresponding methods from the javacv-examples
.
@johngodoi the Ex2ComputeHistogramGraphJava
example can be simplified. No need to extend JFrame
or create a separate thread:
package opencv2_cookbook.chapter04;
import org.bytedeco.javacpp.opencv_core.Mat;
import java.awt.image.BufferedImage;
import java.io.File;
import static opencv2_cookbook.OpenCVUtils.loadAndShowOrExit;
import static opencv2_cookbook.OpenCVUtils.show;
import static org.bytedeco.javacpp.opencv_imgcodecs.IMREAD_GRAYSCALE;
/**
* The second example for section "Computing the image histogram" in Chapter 4, page 92.
* Displays a graph of a histogram created using utility class [[opencv2_cookbook.chapter04.Histogram1D]].
*/
public class Ex2ComputeHistogramGraphJava {
public static void main(final String[] args) {
Mat src = loadAndShowOrExit(new File("data/group.jpg"), IMREAD_GRAYSCALE);
// Calculate histogram
Histogram1DJava h = new Histogram1DJava();
BufferedImage histogram = h.getHistogramImage(src);
// Display the graph
show(histogram, "Histogram");
}
}
There is also an unnecessary canvas.waitKey()
in OpenCVUtilsJava#show(BufferedImage, String)
.
@saudet OpenCVUtils is not totally translated to Java, should I still send a pull to javacv?
@jpsacha I removed JFrame extension and the thread initialization.
It would need to be in Java, yes. Please send a pull request if you make a Java version.
Or do you mean that you didn't translate the whole OpenCVUtils class? That's fine, you can start by sending what you have.
@saudet I didn't translate the whole class
That's fine, please send what you have! Thanks
@johngodoi Thank you for proving the Java versions. They are now merged.
I would like to thank you too, for the support and dedication. I will keep doing it but, sadly, I can't focus on it and do it as frequent as I wish.
If you could send a pull request for OpenCVUtilsJava.java (and maybe name it just OpenCVUtils.java) on the repo for JavaCV, I'd merge that it there (along with a port of OpenCVUtilsTest.scala would be nice too). Then we could also use it from Scala in the examples. @jpsacha what do you think?