I have a program that takes several full-color images, and wherever
each image displays a predetermined color (for example blue), the
program turns it green and coverts all other sections of the picture to
greyscale. Here is the code that is placed in a thread in the program.
cor(c) is an array of the original pictures, cor2(c) is an array of the
manipulated pictures, temp is a color, q is an integer
w=cor(c).width
h=cor(c).height
for k=1 to 217
if c2done(k)=false then //this is a marker to prevent duplication
of the process below
if stopthread=true then exit //this global variable is true if a
cancel button is clicked
for i=0 to w-1
for j=0 to h-1
temp=cor(k).rgbSurface.pixel(i,j) //gets the color of a pixel
q=temp.red //stores the integer value of 'red' for later
if temp=c1 then //sees if the color is one that gets turned
green or grayscale
cor2(k).rgbsurface.pixel(i,j)=rgb(0,255,0) //green
else
cor2(k).rgbsurface.pixel(i,j)=rgb(q,q,q) //greyscale
end
next
next
c2done(k)=true //mark this picture as converted
end
next
This takes a long time... is there a faster way?
Jeff
----------
Jeffrey J. Borckardt, Ph.D.
Department of Psychiatry and Behavioral Sciences
Medical University of South Carolina
67 President Street
IOP, 5 South BA 504 E
Charleston, SC 29425
(843)792-3295
borckard at musc dot edu
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://www.realsoftware.com/listarchives/lists.html>
|