100 likes | 181 Vues
This article discusses the implementation problems encountered by Ken Schmidt, including changing server paths and file format issues. It also explains the process of calculating pixel values for a database and searching for images based on mean and moment values. The author shares the results of different search methods and concludes that grouping pixels by color yields better outcomes compared to using all colors together.
E N D
Image Search Implementation Results Ken Schmidt
Some Implementation Problems • The server changed the path to the SQL tag library <%@ taglib uri="/jccrsrc/misc/jakarta-taglib/dbtags.jar" prefix="sql" %> vs <%@ taglib uri="http://jakarta.apache.org/taglibs/dbtags" prefix="sql" %>
More Implementation Problems • File format to upload image is MultipartRequest Stream, format needed for PixelGrabber is Toolkit Image, no conversion available • Path problems implementing pixelGrabber //load the just stored file as an Image object Toolkit toolkit = Toolkit.getDefaultToolkit(); Image img = toolkit.getImage ( new java.net.URL ( "http://www.mycgiserver.com/~kenwschmidt/search/" + outfile ) ); //wait for entire image to be loaded before proceeding MediaTracker mediaTracker = new MediaTracker ( new Frame ( ) ); mediaTracker.addImage ( img, 0 ); mediaTracker.waitForID ( 0 ); // out.println ("<p>width of Image ="+img.getWidth(null) // + "</p><p>height of Image ="+img.getHeight(null) + "</p>"); //put the Image pixels in the pixels[] array PixelGrabber pg = new PixelGrabber(img, 0, 0, width, height, pixels, 0, width); try { pg.grabPixels(); }
Calculating Pixel Values for DB • Run through pixel array twice, once to obtain the mean • Second time to calculate moments redSum2 +=Math.pow ( ( red - redMean), 2 ); greenSum2 += Math.pow ( ( green- greenMean), 2 ); blueSum2 +=Math.pow ( ( blue-blueMean ),2 ); redSum3 +=Math.pow ( ( red - redMean ), 3 ); greenSum3 +=Math.pow ( ( green- greenMean), 3 ); blueSum3 +=Math.pow ( ( blue- blueMean), 3 ); redSum4 +=Math.pow ( ( red - redMean), 4 ); greenSum4 +=Math.pow ( ( green- greenMean), 4 ); blueSum4 +=Math.pow ( ( blue- blueMean), 4 ); • Then enter all values into DB
Now to Search the DB • Three steps • View all Items in the DB, Select one to match • Enter search criteria • Percent deviation from mean and moment values • Which DB values to search • Retrieve images whose mean or moment values are within the limits • Calculate the upper and lower limits of each value (1 ( deviation %/100 ) ) • Select images within the limits • select * from search where OVERALLMEAN BETWEEN <%=overallMeanDown%> AND <%=overallMeanUp%>
CM-Color Mean GM-Grayscale Mean C2-Color Second Moment G2-Grayscale Second Moment Some ResultsWhich Search Methods Worked?
Conclusions • In each case, taking pixels grouped by color seemed to produce better results than taking all colors together • The third moment did not work well, because it can produce both positive and negative values and I only allowed a deviation maximum of 100% of the value of the search image • The Cambridge Lab used color and texture without image segmentation in combination, I used them separately so that I could see which method produced the best results.