12.07.2015 Views

Digital Image Processing (using Java)

Digital Image Processing (using Java)

Digital Image Processing (using Java)

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

int numPixels = n*n;short[] image = new short[numPixels];randomFill(image);// Perform the mapping directlyIntervalTimer timer = new IntervalTimer();timer.start();for (int i = 0; i < numPixels; ++i)image[i] = (short) Math.round(Math.sqrt(image[i]));System.out.println("direct calculation: " + timer.stop() + " sec");// Perform the mapping with a lookup tablerandomFill(image);timer.start();short[] table = new short[256];for (int i = 0; i < 256; ++i)table[i] = (short) Math.round(Math.sqrt(i));for (int i = 0; i < numPixels; ++i)image[i] = table[image[i]];System.out.println("lookup table: " + timer.stop() + " sec");}System.exit(0);}• <strong>Java</strong> MapTest1- 21 -

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!