12-02-2013 08:59 AM
Yes, i have GetPixelValue for
private NationalInstruments.CWIMAQControls.AxCWIMAQVision axCWIMAQVision1;
12-02-2013 12:40 PM - edited 12-02-2013 12:40 PM
Hello,
I am just guessing here, but this should then be an overloaded function. So if you have an 8-bit image, the prototype should look something like this:
uint8_t GetPixelValue(IMAQ image, int u, int v); // also incudes some error?
I just taking a guess here, since I don't have acces to Labview right now.
So you could probably do something like this:
double YOUR_FUNCTION(IMAQ image, int yT, int xL, int yB, int xR) { uint8_t tmp; unsigned long int sum = 0;
double average; for(int j=yT;j<=yB;j++) {
for(int i=xL;i<=xR;i++) {
tmp = GetPixelValue(image,i,j); sum += (unsigned long int) tmp;
} }
average = (double) sum/(double)((xR-xL)*(yB-yT)); return average;
}
Where xL, xR, yT and yB are the top-left and bottom right coordinates of your ROI (mask).
This approach would be slower than pointer operation shown before.
I hope this helps in some way.
Best regards,
K
12-03-2013 12:59 AM
Hello,
I was wrong, the function prototype looks like:
void LV_GetPixelValue_v2(void *image, int32_t x, int32_t y, uint8_t *u8Pixel, uint16_t *u16Pixel, int16_t *i16Pixel, float *sglPixel, void *err);
So you would need to use the referenece operator (&):
uint8_t pixelValue;
.
.
.
void LV_GetPixelValue_v2(void *image, int32_t x, int32_t y, &pixelValue, uint16_t *u16Pixel, int16_t *i16Pixel, float *sglPixel, void *err);
Best regards,
K
12-10-2013 06:51 AM - edited 12-10-2013 06:53 AM
I think counterpart for LabVIEW function "IMAQ Quantify" is in .NET available.