Ask Your Question

Revision history [back]

Best way to access pixel value from a single channel ? Transform to an array or use existing code ?

Core.extractChannel(mRgba, mR, 0); // for R channel
imageSrc.convertTo(mR, CvType.CV_64FC1);
int size = (int) (mG.total());
double[] dR = new double[size];
mR.get(0, 0, dR);

for (int i = size; i-- > 0;) {
dR[i] = /** do the work */
}

Or accessing pixel value with for x and for y ? ".At" is not allowed in java version of OpenCv 2.4.6

Best way to access pixel value from a single channel ? Transform to an array or use existing code ?

Core.extractChannel(mRgba, mR, 0); // for R channel
imageSrc.convertTo(mR, CvType.CV_64FC1);
int size = (int) (mG.total());
double[] dR = new double[size];
mR.get(0, 0, dR);

for (int i = size; i-- > 0;) {
dR[i] = /** do the work */
}

Or accessing pixel value with for x x and for y ? ".At" is not allowed in in java version of OpenCv 2.4.6

Other way (Moose)
width = mR.width(); height  = mR.height(); 
byte[] bR = new byte{size]; 
for (y= height , y-- >0;) for (x =with, y-- >0;) //Best to work with row 2 Best to decrease  counter

bR.get(y, x).val[0} = /** do the work */ } }

click to hide/show revision 3
two speed way to access pixel value ? Wich one are you using ?

Best way to access pixel value from a single channel ? Transform to an array or use existing code ?

Core.extractChannel(mRgba, mR, 0); // for R channel
imageSrc.convertTo(mR, CvType.CV_64FC1);
int size = (int) (mG.total());
double[] dR = new double[size];
mR.get(0, 0, dR);

for (int i = size; i-- > 0;) {
dR[i] = /** do the work */
}

Or accessing pixel value with for x x and for y ? ".At" is not allowed in in java version of OpenCv 2.4.6

Other way (Moose)
(Moster)
 width = mR.width(); height = mR.height();
 byte[] bR = new byte{size];
 for (y= height , y-- >0;) for (x =with, y-- >0;) //Best to work with row 2 Best to decrease counter
counter

bR.get(y, x).val[0} = /** do the work */ } }

}

Best way to access pixel value from a single channel ? Transform to an array or use existing code ?

This one

Core.extractChannel(mRgba, mR, 0); // for R channel
imageSrc.convertTo(mR, CvType.CV_64FC1);
int size = (int) (mG.total());
double[] dR = new double[size];
mR.get(0, 0, dR);

for (int i = size; i-- > 0;) {
dR[i] = /** do the work */
}

Or accessing pixel value with for x and for y ? ".At" is not allowed possible in java version of OpenCv 2.4.62.4.6 Other way (Moster)

Other way (Moster)



 width = mR.width(); height  = mR.height(); 
     byte[] bR = new byte{size]; 
     for (y= height , y-- >0;) for (x =with, y-- >0;) //Best to work with row 2 Best to decrease  counter  
 bR.get(y, x).val[0} = /** do the work */ } }

Best way to access pixel value from a single channel ? Transform to an array or use existing code ?

This one

Core.extractChannel(mRgba, mR, 0); // for R channel
imageSrc.convertTo(mR, CvType.CV_64FC1);
int size = (int) (mG.total());
double[] dR = new double[size];
mR.get(0, 0, dR);

for (int i = size; i-- > 0;) {
dR[i] = /** do the work */
}

Or accessing pixel value with for x and for y ? ".At" is not possible in java version of OpenCv 2.4.6 Other way (Moster)

width = mR.width(); height  = mR.height(); 
        byte[] bR = new byte{size]; 
        for (y= height , y-- >0;) for (x =with, y-- >0;) //Best to work with row 2 Best to decrease  counter  
    bR.get(y, x).val[0} = /** do the work */ } }