All About Circuits Forum  

Go Back   All About Circuits Forum > Software, Microcomputing, and Communications Forums > Programmer's Corner

Notices

Programmer's Corner Discussion forum for all aspects of programming and software engineering. Any software programming language welcome: C, C++, C#, Fortran, Java, Matlab, etc.

Reply   Post New Thread
 
Thread Tools Display Modes
  #1  
Old 06-27-2007, 09:01 AM
Fadel Megahed Fadel Megahed is offline
Junior Member
 
Join Date: Jun 2007
Posts: 12
Default Matlab: Deleting pixels from an image (desperate)

Hi,

I am working on this big project and i would like if anyone could help me generate a code that would delete all pixels under 20 from an image.
I am really stuck in the project and I am desperate for your help
Thanks a lot everyone,
Reply With Quote
  #2  
Old 06-27-2007, 01:52 PM
Papabravo's Avatar
Papabravo Papabravo is offline
Senior Member
 
Join Date: Feb 2006
Location: Michigan, USA (GMT-5)
Posts: 5,780
Default

I'm not clear about your requirements. Do you want to remove the pixels from the image, or do you want to change the value of the pixels to some other value? The first would probably destroy the image. The second, depending on the meaning of less than 20, would produce something that looks like a false color image. It would also help to know what format the image is in. We are not blessed with clairvoyance or astral projection; you're just going to have to tell us, there is no other way.
__________________
We never have time to do it right,
But we always have time to do it over.
Reply With Quote
  #3  
Old 06-27-2007, 03:41 PM
Fadel Megahed Fadel Megahed is offline
Junior Member
 
Join Date: Jun 2007
Posts: 12
Default

The image is a .jpg one
The function of the program is to remove the background out of the picture so that when a histogram is developed, it has the focus zones only

Thanks
Reply With Quote
  #4  
Old 06-28-2007, 07:30 AM
Papabravo's Avatar
Papabravo Papabravo is offline
Senior Member
 
Join Date: Feb 2006
Location: Michigan, USA (GMT-5)
Posts: 5,780
Default

OK. Assuming you know the format of a .jpeg file a program might look like the following:
Code:
Open filename.jpeg for input
Open Modified_filename.jpeg for output
Read and process header
Copy header to output
while(.not. EndofFile)
{
    pixel = getNextPixel() ;
    if(pixel < 20) pixel = 0 ;
    writePixel(pixel) ;
}
Close(filename.jpeg) ;
Close(Modifed_filename.jpeg) ;
Select All
__________________
We never have time to do it right,
But we always have time to do it over.
Reply With Quote
  #5  
Old 07-02-2007, 09:24 AM
Fadel Megahed Fadel Megahed is offline
Junior Member
 
Join Date: Jun 2007
Posts: 12
Default Thanks a lot

It worked
Reply With Quote
  #6  
Old 07-02-2007, 11:50 AM
Papabravo's Avatar
Papabravo Papabravo is offline
Senior Member
 
Join Date: Feb 2006
Location: Michigan, USA (GMT-5)
Posts: 5,780
Default

That's terrific, and you didn't even need a tutorial on the pseudo-code language I made up on the spur of the moment. I'm quitting my day job and going into language design. I may have a bright future. On second thought since retirement is just around the corner I think I'll find a couch and take a nap. Yeah...a nap, that's the ticket!
__________________
We never have time to do it right,
But we always have time to do it over.
Reply With Quote
Reply   Post New Thread

Tags
, , , ,


Similar Threads
Thread Thread Starter Forum Replies Last Post
MATLAB image processing desperate for help princesstina Homework Help 1 06-26-2014 10:30 AM
MATLAB Help SHuzero Programmer's Corner 3 02-22-2012 09:35 AM
Matlab Image Processing Help (Image Segmentation) peep2k Programmer's Corner 2 11-06-2009 11:28 PM
Matlab project help!! Image comperison. prionkor Programmer's Corner 0 06-08-2009 08:14 AM
Useful Matlab Information Dave Programmer's Corner 7 11-09-2008 05:51 AM

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:30 PM.


User-posted content, unless source quoted, is licensed under a Creative Commons Public Domain License.
Powered by vBulletin
Copyright ©2000 - 2014, vBulletin Solutions, Inc.