Question

I am converting a complete set of C++ codes to java which includes openCv. For java conversion i am using JavaCV. Now, i am trying to convert this code into java:

CvScalar s;
IplImage* pImg =cvCreateImage(cvSize(1000,1000),IPL_DEPTH_8U,1);
IplImage* Edges =cvCreateImage(cvSize(1000,1000),IPL_DEPTH_8U,1);
for(i=0; i<=xd; i++)
{
    for(j=0; j<=yd; j++)
    {
        if(Bimg[xmin+i][ymin+j]==nIsland)
        { 
            s.val[0]=255;
        }
        else
        {
            s.val[0]=0;
        }
        cvSet2D(pImg,i,j,s); //See ref 4
    }
}

Now i want to convert this s.val[0] = 255 to java so, i am typing the same code statement ie. s.val[0] = 255 but it is showing me error. Please help. how do i convert that into java code.

Was it helpful?

Solution

your value assigning is incorrect for javacv

CvScalar s = // init 
.....
if (s.getVal(i) == ?? ) 
   s.setval(i, new_value);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top