Ask Your Question

Revision history [back]

Compare pixel value with threshold in Java

Dear.

As some algorithm requires, e.g Harris corner detection, it is necessary to compare pixel value with a defined threshold. I know that in C++ it can be done quickly with command

if(image.at<float>(i,j> int thres){}

But I have some problems doing it in Java, as I found only one command is

double [] pixel=image.get(i,j);

Could you please let me know how to perform comparision in this case?

Or in the doc of opencv, it is stated that the output could be int if

int pixel= image.get(int i, int j, byte[] data);

but I am not sure what to do with the parameter byte[] data.

Regards

Compare pixel value with threshold in Java

Dear.

As some algorithm requires, e.g Harris corner detection, it is necessary to compare pixel value with a defined threshold. I know that in C++ it can be done quickly with command

if(image.at<float>(i,j> if(image.at<float>(i,j) > int thres){}

But I have some problems doing it in Java, as I found only one command is

double [] pixel=image.get(i,j);
pixel=image.get(int i, int j);

Could you please let me know how to perform comparision in this case?

Or in the doc of opencv, it is stated that the output could be int if

int pixel= image.get(int i, int j, byte[] data);

but I am not sure what to do with the parameter byte[] data.

Regards