straight line detection in android -


i have image like:

and image:

i have taken image of laser line. aim check if image contains straight line of laser.if image contains straight line give message "straight line found" else "straight line not found". want in android. input image sd card , output message. provided 1stimage should give message "straight line found" , 2nd image should give message "straight line not found" . tried cant reach goal:

         int iwidth2 = bmp.getwidth();               for(int i=0;i<bmp.getheight();i++)            {                int found=0;                 for(int j=0;j<bmp.getwidth();j++)                {                     if(pixels[(i*iwidth2)+j]==color.red)                    {                        found++;                    }                  }                  if(((found*100)/bmp.getwidth())>80)                 {                     toast.maketext(getapplicationcontext(), " straight ",  toast.length_short).show();                  }             } 

as laser color not red , that's why doesn't give correct result.

if background of picture black, try detect not black color, not unknown color of laser.

if(pixels[(i*iwidth2)+j]!=color.black) {   found++; } 

Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -