Ask Your Question

opencv<cv::Vec4b> convert to java

asked 2018-04-02 01:47:14 -0500

jhovarie gravatar image

updated 2018-04-02 01:48:00 -0500

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 =<cv::Vec4b>(y,x)[0];
     int green =<cv::Vec4b>(y,x)[1];
     int blue =<cv::Vec4b>(y,x)[2];

    //to set the pixel
     //<cv::Vec4b>(y,x)[0] = 100;
     //<cv::Vec4b>(y,x)[1] = 0;
     //<cv::Vec4b>(y,x)[2] = 200;

Any help? I need java version of this code.

edit retag flag offensive close merge delete


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.

berak gravatar imageberak ( 2018-07-07 10:26:54 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2018-07-07 09:47:48 -0500

ali hakimiyan gravatar image

in java you can use get(i,j)

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-04-02 01:47:14 -0500

Seen: 194 times

Last updated: Jul 07 '18