Code for Image Processing

Reply

Join Date: Sep 2004
Posts: 7,602
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 713
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: Code for Image Processing

 
0
  #11
Nov 10th, 2004
>How do i deal with a colour image (probably in .tiff format)?
The code for processing an image depends heavily on the image format. Go here and read up on the .tiff format to see what's involved.
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 3,971
Reputation: vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice 
Solved Threads: 920
Moderator
vegaseat's Avatar
vegaseat vegaseat is offline Offline
DaniWeb's Hypocrite

Re: Code for Image Processing

 
0
  #12
Nov 13th, 2004
What a lively thread!!!

I have been accused of using lame old Turbo C code in the past by our friend Narue, and heeded her salutary advice. I have to admit that I enjoy her comments a lot, and of course the always impeccable English. Please take it easy on Narue, she is a heck of a good programmer!!!
May 'the Google' be with you!
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 353
Reputation: Asif_NSU is on a distinguished road 
Solved Threads: 3
Asif_NSU's Avatar
Asif_NSU Asif_NSU is offline Offline
Posting Whiz

Re: Code for Image Processing

 
0
  #13
Nov 13th, 2004
Originally Posted by vegaseat
What a lively thread!!!

I have been accused of using lame old Turbo C code in the past by our friend Narue, and heeded her salutary advice. I have to admit that I enjoy her comments a lot, and of course the always impeccable English. Please take it easy on Narue, she is a heck of a good programmer!!!
Whaatttt? i thought Narue was a guy!!!

Well she is a good programmer but an even better critic.
"He who mixes with people and endures the harm they do is better than he who does not mix and endures." (Tirmidhi)
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,143
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 213
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: Code for Image Processing

 
0
  #14
Nov 13th, 2004
According to her profile she's a gal. Either that or the photo shows someone else
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,143
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 213
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: Code for Image Processing

 
0
  #15
Nov 13th, 2004
To add: you can get information on just about any fileformat you want at http://www.wotsit.org
Sometimes complete C or other code is included.
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 31
Reputation: dalaharp is an unknown quantity at this point 
Solved Threads: 0
dalaharp dalaharp is offline Offline
Light Poster

Re: Code for Image Processing

 
0
  #16
Nov 16th, 2004
hi narue,
nice try..but i still think that you suck.. never mind..
the reason i posted that code with all the flaws and pitfalls as you have described it, is because i was also finding the same solution as ritcherjd and thought helping him will help me too..
well master (never mind what gender u are), i am willing to learn..
could you please tell me how a picture is encoded into a .dat (data file) format ?

and what are the flaws in my code??

thanks..
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,602
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 713
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: Code for Image Processing

 
0
  #17
Nov 16th, 2004
>nice try..but i still think that you suck
I'm sorry that my well informed arguments didn't penetrate your barrier of idiocy.

>the reason i posted that code <snip excuse>
That's nice. Next time say so to avoid teaching bad habits. And before you answer, "If you find a better way" doesn't count as a disclaimer that your code bites.

>could you please tell me how a picture is encoded into a .dat (data file) format ?
.dat isn't an image file format.

>and what are the flaws in my code??
Off the top of my head:

>#include <math.h>
You don't use any math routines, this can be removed.

>#include <conio.h>
Your use of conio functions is limited to poor examples that can be either avoided as stupid, or replaced with a standard function.

>void main( )
This makes your program completely undefined. The proper definition for main is
  1. int main ( void )
or
  1. int main ( int argc, char *argv[] )
if you process command line arguments.

>unsigned char i[100][100;
Syntax error, you forgot a closing square bracket.

>clrscr();
Unnecessary. It only serves to make your code nonportable.

>if((fp = fopen("lenna.dat","r+")) == 0)
There's no need to open this stream as an update stream. All you do is read from it, so the mode should be "r". Hardcoding the filename is also a bad practice. A better solution would be to ask the user for a file to open. Also, on a purely stylistic note, NULL is more descriptive than 0 when testing for a null pointer.

>exit(1);
1 isn't a portable argument for exit. A better choice would be EXIT_FAILURE, defined in stdlib.h.

>fscanf(fp,"%c",&i[m][n]);
That's a lot of work just to get the same effect as
  1. i[m][n] = (unsigned char)fgetc ( fp );
There are also potential issues with mixing char and unsigned char in scanf, not to mention that i is an awful choice of names for your array.

>getch();
This can be replaced with getchar() at only a minor inconvenience to users that care.
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 31
Reputation: dalaharp is an unknown quantity at this point 
Solved Threads: 0
dalaharp dalaharp is offline Offline
Light Poster

Re: Code for Image Processing

 
0
  #18
Nov 17th, 2004
next time i cut a chunk of code from a bigger program i will remember narue, and modify it b4 submitting it.
anyways i thought it is enough to get the message through than the aesthetic appeal of the code. (which some purist might oppose to)
but hey, thanks for the remarks.
and if .dat is not an image file format(ok), but images ARE encoded and represented in .dat format.
so it CAN be read by my code. and image processing operations can be done pixel wise.
or am i wrong again??
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 220
Reputation: frrossk is an unknown quantity at this point 
Solved Threads: 9
frrossk's Avatar
frrossk frrossk is offline Offline
Posting Whiz in Training

Re: Code for Image Processing

 
0
  #19
Nov 18th, 2004
Originally Posted by dalaharp
and if .dat is not an image file format(ok), but images ARE encoded and represented in .dat format.
so it CAN be read by my code. and image processing operations can be done pixel wise.
or am i wrong again??
You're right, but you have to know exactly how long is the file header, how the info is stored in the file, the encoding algorithm etc...
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 31
Reputation: dalaharp is an unknown quantity at this point 
Solved Threads: 0
dalaharp dalaharp is offline Offline
Light Poster

Re: Code for Image Processing

 
0
  #20
Nov 18th, 2004
i guess that the .dat file does not have a file header, and the info is stored as data bits, and can be represented in an 2d array.
now moving a little further, how to rotate this image in an array.
see if i rotate it by 45degree, then the image falls out ofthe grid.
then image data is lost.
will resizing the array help, then the extra array elements added will have garbage data..
wont it???
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC