count Pixel coordinates x and y

前端 未结 1 1957
予麋鹿
予麋鹿 2021-01-15 21:43

i try this code to summation the pixels coordinates (x,y) in the image

this is the code

#include
#include
#include

        
相关标签:
1条回答
  • 2021-01-15 22:28

    What's with these loops?

    for(int x=0;x>image->width;x++)
    {
        for(int y=0;image->height;y++)
    

    Should be:

    for(int x=0;x<image->width;x++)
    {
        for(int y=0;y<image->height;y++)
    

    right?

    Plus also, what's with this?:

            Sx=se.val[y];
            Sx+=Sx;
    

    You're resetting Sx every loop iteration and then doubling it, but then throwing that computation away next loop iteration. Similar issues with the Sy.

    I encourage you take a look at your program line by line and really think about what it's doing before you post questions publically.

    0 讨论(0)
提交回复
热议问题