[問題] OpenCV讀取像素值的問題請求解救。
開發平台(Platform): Linux + OpenCV 2.1
額外使用到的函數庫(Library Used): OpenCV
問題(Question):讀取的每一個像素值不正確。
餵入的資料(Input):
uchar* water_pixel;(全域)
for(row=0;row<water_img->height;row++)
{
//printf("the %d row : ",row);
for(col=0;col<water_img->width;col++)
{
water_pixel = (uchar*)(water_img->imageData+row*water_img->widthStep +
col);
printf("%d this is upper %3d\n ",total, water_pixel[total]);
total+1;
}
}
printf("water pixel for 11 is = %3d\n", water_pixel[10]);
printf("water pixel for 3000 is = %3d\n", water_pixel[2999]);
int x, y, z;
for ( x = 0, y=0,z =0; x < water_size; x++ )
{
printf("%d Water_pixel %d = %d\n",z, x, water_pixel[y]);
z++;
y+1;
}
預期的正確結果(Expected Output):
小弟的像素值為,pixel 0 = 251, pixel 11 = 238, pixel 3000 = 195
錯誤結果(Wrong Output):
錯誤結果出來為,piexel 11 = 0, pixel 3000 = 248, 全部的pixel(for迴圈的)
都是255,全部都不是我的像素值。
程式碼(Code):(請善用置底文網頁, 記得排版)
補充說明(Supplement):
懇請神人協助小弟,小弟找不到問題處。
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 118.232.205.45
推
08/22 17:27, , 1F
08/22 17:27, 1F
→
08/22 18:26, , 2F
08/22 18:26, 2F
推
08/22 22:52, , 3F
08/22 22:52, 3F
→
08/22 22:53, , 4F
08/22 22:53, 4F
→
08/22 22:53, , 5F
08/22 22:53, 5F
→
08/22 22:54, , 6F
08/22 22:54, 6F
→
08/22 22:55, , 7F
08/22 22:55, 7F
→
08/22 22:56, , 8F
08/22 22:56, 8F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章