It detect a non-black pixel by executing
"
return (colour != BLACK) ? true : false;
"
where BLACK is an integer holding the super big number, 256*256*256.
DEMO
Bad Points to note:
The program will be doing a for loop, extracting all the RGB value of the pixels' colour. This algorithm is a O(n2) algorithm, and takes a very long time to execute. We will be working on the algorithm again to decrease the time and execution speed to at most a O(n) algorithm. This reason is that if the picture we were having is very big, the user may need to wait a very long time before he can get a result. It may not be very good for commercial uses.
No comments:
Post a Comment