1 | initial version |
Hi, your pixel assigning in the loop is wrong. You read some repetitious pixels from pixelsRGB and wrote them to m_frameData pixels, in other word pixels coordinates of pixelsRGB doesn't update properly in each loop. You should try this :
for(unsigned int x = 0; x < frame.rows; x++)
{
for (unsigned int y = 0; y < frame.cols; y++)
{
m_frameData->atXYZC(x,y,0,0) = (int) pixelsRGB[ (3*y) + 3*x*frame.cols];
m_frameData->atXYZC(x,y,0,1) = (int) pixelsRGB [ (3*y+1) + 3*x*frame.cols];
m_frameData->atXYZC(x,y,0,2) = (int) pixelsRGB[ (3*y+2) + 3*x*frame.cols];
} }
I hope it works.
2 | No.2 Revision |
Hi, your pixel assigning in the loop is wrong. You read some repetitious pixels from pixelsRGB and wrote them to into m_frameData pixels, in other word word, pixels coordinates of pixelsRGB doesn't update properly in each loop. You should try this :
for(unsigned int x = 0; x < frame.rows; x++)
{
for (unsigned int y = 0; y < frame.cols; y++)
{
m_frameData->atXYZC(x,y,0,0) = (int) pixelsRGB[ (3*y) + 3*x*frame.cols];
m_frameData->atXYZC(x,y,0,1) = (int) pixelsRGB [ (3*y+1) + 3*x*frame.cols];
m_frameData->atXYZC(x,y,0,2) = (int) pixelsRGB[ (3*y+2) + 3*x*frame.cols];
} }
I hope it works.
3 | No.3 Revision |
Hi, your pixel assigning in the loop is wrong. You read some repetitious pixels from pixelsRGB and wrote them into m_frameData pixels, in other word, pixels coordinates of pixelsRGB doesn't update properly in each loop. And you also have to alternate x and y in atXYZC. You should try this :
for(unsigned int x = 0; x < frame.rows; x++)
{
for (unsigned int y = 0; y < frame.cols; y++)
{
m_frameData->atXYZC(x,y,0,0) m_frameData->atXYZC(y,x,0,0) = (int) pixelsRGB[ (3*y) + 3*x*frame.cols];
m_frameData->atXYZC(x,y,0,1) m_frameData->atXYZC(y,x,0,1) = (int) pixelsRGB [ (3*y+1) + 3*x*frame.cols];
m_frameData->atXYZC(x,y,0,2) m_frameData->atXYZC(y,x,0,2) = (int) pixelsRGB[ (3*y+2) + 3*x*frame.cols];
} }
I hope it works.
4 | No.4 Revision |
Hi, your pixel assigning in the loop is wrong. You read some repetitious pixels from pixelsRGB and wrote them into m_frameData pixels, in other word, pixels coordinates of pixelsRGB doesn't update properly in each loop. And you also have to alternate x and y in atXYZC. You should try this this(It works for BGR format not RGB, you don't have to change the image to RGB) :
for(unsigned int x = 0; x < frame.rows; x++)
{
for (unsigned int y = 0; y < frame.cols; y++)
{
m_frameData->atXYZC(y,x,0,0) = (int) pixelsRGB[ (3*y) + 3*x*frame.cols];
m_frameData->atXYZC(y,x,0,1) = (int) pixelsRGB [ (3*y+1) + 3*x*frame.cols];
m_frameData->atXYZC(y,x,0,2) = (int) pixelsRGB[ (3*y+2) + 3*x*frame.cols];
} }
I hope it works.