Code for Image Processing

Reply

Join Date: Nov 2004
Posts: 9
Reputation: ritcherjd is an unknown quantity at this point 
Solved Threads: 0
ritcherjd ritcherjd is offline Offline
Newbie Poster

Code for Image Processing

 
0
  #1
Nov 8th, 2004
I have a problem at hand. It is to generate a C code - i need to do the following, i will capture an image, then i have to this image into an array using C on which i can do some image processing. How do i go about it? If someone could give me some codes showing how to procedd it would be great....

thank u
j
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
  #2
Nov 8th, 2004
for starters u can get the image (100x100 pixels) in this way..
then alter the value of each pixel to change the image..

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <conio.h>

void main( )
{
FILE *fp;
unsigned char i[100][100;
int m,n;
clrscr();

if((fp = fopen("lenna.dat","r+")) == 0)
{
printf("Just conat open the specified file.\n");
exit(1);
}
else
{
for(m=0;m<100;m++)
{
for(n=0;n<100;n++)
{
fscanf(fp,"%c",&i[m][n]);
}
}
fclose(fp);
getch();
}
hope this helps..
if u find a better way, tell me..
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 9
Reputation: ritcherjd is an unknown quantity at this point 
Solved Threads: 0
ritcherjd ritcherjd is offline Offline
Newbie Poster

Re: Code for Image Processing

 
0
  #3
Nov 9th, 2004
Thanx dalaharp .. ill try it out

j
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 9
Reputation: ritcherjd is an unknown quantity at this point 
Solved Threads: 0
ritcherjd ritcherjd is offline Offline
Newbie Poster

Re: Code for Image Processing

 
0
  #4
Nov 9th, 2004
I tried running it in vc++ , it gave me the foll errors. I add the image which i want to read into the resource file right??
Other than that i have another doubt
How do i modify it for accomodating a colour image?

The 2 errors
readimage.obj : error LNK2001: unresolved external symbol _clrscr
Debug/test.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

ty

Originally Posted by dalaharp
for starters u can get the image (100x100 pixels) in this way..
then alter the value of each pixel to change the image..

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <conio.h>

void main( )
{
FILE *fp;
unsigned char i[100][100;
int m,n;
clrscr();

if((fp = fopen("lenna.dat","r+")) == 0)
{
printf("Just conat open the specified file.\n");
exit(1);
}
else
{
for(m=0;m<100;m++)
{
for(n=0;n<100;n++)
{
fscanf(fp,"%c",&i[m][n]);
}
}
fclose(fp);
getch();
}
hope this helps..
if u find a better way, tell me..
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,534
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: 704
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: Code for Image Processing

 
0
  #5
Nov 9th, 2004
>error LNK2001: unresolved external symbol _clrscr
clrscr is a frivolous function that only an ignorant newbie or a blatant antisocial prick would use at the start of their program (and usually everywhere else too). You can safely remove it. You may also need to change getch to _getch to compile with Visual Studio. If you're able to link then clearly you've found and corrected the other errors.
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 10
Reputation: wonderboyshp is an unknown quantity at this point 
Solved Threads: 0
wonderboyshp wonderboyshp is offline Offline
Newbie Poster

Re: Code for Image Processing

 
0
  #6
Nov 9th, 2004
in such compilers as VisualStudio .NET 2003 you need to use the system() command for clear screen it is something like System(cls); or something like that, and Narue I would like to state that running a program in a DOS window without the occasional claer screen will be quite messy and a clear screen just helps to keep it clean and neat. It is all for aesthetics. It doesn't make you an antisocial prick. Callign somebody that based on a clearscreen use is just ignorant, no offense.
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,534
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: 704
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: Code for Image Processing

 
0
  #7
Nov 9th, 2004
>you need to use the system() command for clear screen
Just because it's available doesn't mean you should use it. There are three big reasons not to use system for this: Security, portability, and performance. You would do better to write your own screen clearing function using the Win32 API than to use system.

>I would like to state that running a program in a DOS window without the occasional claer screen will be quite messy
I would like to retort that clearing the screen when your program starts is antisocial because it removes all output from prior programs. I don't imagine you would be thrilled to have data that you intended to use for reference wiped out because some moron wanted things to look cleaner. If you're running from an IDE then clearing the screen at program start is stupid because it does nothing. The console window is empty to begin with.

>and a clear screen just helps to keep it clean and neat.
Who are you to judge whether a console that you don't own needs to be kept clean and neat? If you do own the window then by all means clear the screen if you think it improves life, but you only prove your idiocy by doing it on a fresh window. Really the only valid reason for clearing the console window in programs like these is for showing cute attention getters like paging menus and animation. There are better tools for such things, so you're only arguing in favor of cluelessness. And did I mention that there's absolutely no way to clear the screen portably?

>It doesn't make you an antisocial prick.
Clearly you've never been on the receiving end of a screen clear and had critical data wiped out. Therefore you're in no position to defend the newbies of the world.

>Callign somebody that based on a clearscreen use is just ignorant
No offense, but you seem to be the ignorant one in this case. You decided to champion a bad practice when you were unaware of the issues involved.

>no offense.
None taken, you made an honest try.
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

 
-1
  #8
Nov 10th, 2004
well well well guys, what all this???
hi narue..
i am a newbie and if i am not ignorant i might as well be a great genius like you and not an 'ignorant newbie'..
and what was the other thing u said, 'blatant antisocial prick'
well i thought this forum is for getting help and helping others and not for practising your fancy obnoxious comments on fellow members..
if u think my code has flaws, you have all the privileges to state so..
cause if u look back, i ha quoted.
"hope this helps..
if u find a better way, tell me.. "
:mad: with all due respect to your so called brilliance, 'you suck'..

nevertheless, ritcherjd, i tried this code on turbo C and is working fine..
i dont know what modification to make for vc++..
this code is to read a gray scale image in .raw format or .dat format..
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,534
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: 704
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: Code for Image Processing

 
0
  #9
Nov 10th, 2004
>i am a newbie and if i am not ignorant i might as well be a great genius like you
Look up the definition of ignorant before you rant, please. It's not an insult, so stop acting defensive. Now, when I call you a moron, that's an insult and you're free to interpret it as such.

>and what was the other thing u said, 'blatant antisocial prick'
That's for the people who know the issues but still decide to use a bad construct. You clearly aren't in that camp, so it doesn't apply to you. If it did you would be completely within your rights to be insulted.

>well i thought this forum is for getting help and helping others
I do help others. But you're too busy worrying about the harsh comments to see the help that was given. I'm not responsible for your inability to look past your own ego; that's a personal problem.

>and not for practising your fancy obnoxious comments on fellow members..
Actually, that's one of the main reasons I frequent this forum. I'm much nicer on the other sites I visit, and if one doesn't vent then it causes excess stress. When I stop helping people then you have a right to complain.

>cause if u look back, i ha quoted
This is clearly referring to the algorithm and not the poor framework. But if you'd like I can give you a full code review, detailing all of the flaws and pitfalls, because it does have serious problems as posted.

>with all due respect to your so called brilliance
You seem to think that I'm arrogant enough to consider myself a genius. I'm not, I don't, and not once have I ever implied that I do. You're mistaking confidence in my abilities with ego.

>'you suck'..
Get over yourself and at least make an attempt to learn what I tried to teach in this thread. I'm not here to make you feel good about yourself, I'm here to help you improve your programs. If I hurt your feelings at any point, I don't care because how you feel isn't a high priority for me.
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 9
Reputation: ritcherjd is an unknown quantity at this point 
Solved Threads: 0
ritcherjd ritcherjd is offline Offline
Newbie Poster

Re: Code for Image Processing

 
0
  #10
Nov 10th, 2004
well well - looks like this thread has blown out of proportion.. Could someone help me out with the other problem? How do i deal with a colour image (probably in .tiff format)? Think Narue can deal with this?? I am a newbie and am looking for some help....

ty
j
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