User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Java section within the Software Development category of DaniWeb, a massive community of 397,725 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,506 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Java advertiser: Lunarpages Java Web Hosting
Views: 2834 | Replies: 2
Join Date: Feb 2005
Posts: 1
Reputation: PaulaS is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
PaulaS PaulaS is offline Offline
Newbie Poster

Help! Scanning through each image pixel...

  #1  
Feb 12th, 2005
Hi,

I have a project where we need to scan each pixel from an image. Somewhere in the image there will be a 10x10 red pixel and we need to draw a circle around it. This is the code I have so far: (but I'm having trouble figureing out the code to scan each pixel?) Any help would be great! Thanks

public static void main(String[] args) {

TheMatrix picture = new TheMatrix(EasyInput.openFileDialog());
int width = picture.getWidth();
int height = picture.getHeight();
int[] pixels;
for (int x = 0; x < width; x++){
for (int y = 0; y < height; y++){
Color c = picture.getColor(x, y);
if (c == Color.RED){
for (int x = 0; x < 199; ++x) {
int y = (int) (Math.sqrt(200 * 200 - x * x));
picture.setColor(250 + x, 250 + y, Color.WHITE);
picture.setColor(250 - x, 250 + y, Color.WHITE);
picture.setColor(250 + x, 250 - y, Color.WHITE);
picture.setColor(250 - x, 250 - y, Color.WHITE);
picture.show();
}


Paula
AddThis Social Bookmark Button
Reply With Quote  

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb Java Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the Java Forum

All times are GMT -4. The time now is 2:29 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC