opencv mat.at<cv::Vec4b> convert to java
Hello I have opencv code written on objective-c I dont know how to convert it on java..
The objective c code looks like this.
cv::Math image2 = .....
for(int x = image2.cols; x >= 0; --x){
for(int y = 0; y < image2.rows; y++) {
int red = image2.at<cv::Vec4b>(y,x)[0];
int green = image2.at<cv::Vec4b>(y,x)[1];
int blue = image2.at<cv::Vec4b>(y,x)[2];
//to set the pixel
//image2.at<cv::Vec4b>(y,x)[0] = 100;
//image2.at<cv::Vec4b>(y,x)[1] = 0;
//image2.at<cv::Vec4b>(y,x)[2] = 200;
}
}
Any help? I need java version of this code.
the c++ code is already broken (BGR vs. RGB, also is the type really RGBA or Vec4 ?)
and you should avoid any per pixel code, using openvc.
please learn the api, don't try to defeat it by writing your own loops.