Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the meaning of following code line in opencv?

What does this code line means and how can I convert this code into javacv?

gray = Scalar::all(255);

This is whole code which related to this code line.

Mat src = imread("in.jpg"), gray;

cvtColor(src, gray, CV_BGR2GRAY);
threshold(gray, gray, 230, 255, THRESH_BINARY_INV);
vector<Vec4i> hierarchy;
vector<vector<Point> > contours;
findContours(gray, contours, hierarchy, CV_RETR_LIST, CV_CHAIN_APPROX_SIMPLE);

gray = Scalar::all(255);

Please can some one explain about this ?

like image 807
NadLnk Avatar asked Oct 08 '22 06:10

NadLnk


1 Answers

As I mentioned in my comment, it is used to set the gray image to white.

What is its benefit? It can be said only if we know what is this code for or see the full code.

Regarding Java, OpenCV has now some android samples, in which you can find Java codes.

You can check them. I saw a similar function there : mWhilte = Scalar.all(255);

Also check the JavaCV samples : http://code.google.com/p/javacv/wiki/OpenCV2_Cookbook_Examples_Chapter_2

like image 81
Abid Rahman K Avatar answered Oct 13 '22 10:10

Abid Rahman K