?
Solved

"Edge-detection" code

Posted on 2007-10-21
15
Medium Priority
?
2,892 Views
Last Modified: 2016-08-29
I'm working on a school project that requires me to come up with an "edge-detection" (ED) algorithm.      

If you aren't familiar what "edge-detection" does, please check out the 2 samples pics ("Before" and "After") posted at:
https://filedb.experts-exchange.com/incoming/ee-stuff/5117-SampleJPGs.zip   

The ED functionality is part of many image processing programs.   I simply have to re-create it as part of this project.  

As I'm not having much experience in C/C++ programming, I'm really struggling to get this done.   My questions:

1. Does anyone know where I could find the let's say 80% solution for ED?
2. As ExpertExchange isn't intended to host sample files, do you know of another good C/C++ site where I could find some sample code?    

Again, pls keep in mind that I have this very specific topic in mind.   A general C/C++ site may not provide me the help I need.

Thank you,
EEH

P.S.  There are several different methods (e.g. gradient and Laplacian).   I don't even worry about those different approaches right now.   A basic program will be sufficient.

0
Comment
Question by:ExpExchHelp
15 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 1200 total points
ID: 20118052
You will find a sample project using GDI+ for that purpose at http://www.codeproject.com/vcpp/gdiplus/edge_detection_in__c.asp ("Edge Detection Using C,Win32 SDK and GDI+"). some general theory at http://www.codepedia.com/1/Edge+detection and the implementation of a gaussian filter at http://www.pages.drexel.edu/~nk752/Research/cannyTut2.html  (be sure to also read http://www.pages.drexel.edu/~weg22/can_tut.html which is linked from there)
0
 
LVL 55

Assisted Solution

by:Jaime Olivares
Jaime Olivares earned 400 total points
ID: 20118094
Also have a look to this article:
http://www.codeproject.com/cs/media/edge_detection.asp

it is written in C# but it has a good theory frame
0
 

Author Comment

by:ExpExchHelp
ID: 20118096
jkr:

I think I've come across the first source (Code Project) before.   I tried to implement this in Visual C++.   I put all of the source code into a single CPP file.  

I get the following error/warning:

1>c:\bc5\00 msim 695 testing\edd\edgedetection\edgedetection\edgedetection.cpp(1) : warning C4005: 'UNICODE' : macro redefinition
1>        command-line arguments : see previous definition of 'UNICODE'
1>c:\bc5\00 msim 695 testing\edd\edgedetection\edgedetection\edgedetection.cpp(2) : fatal error C1083: Cannot open include file: 'windows.h': No such file or directory
1>Build log was saved at "file://c:\BC5\00 MSIM 695 Testing\EDd\EdgeDetection\EdgeDetection\Debug\BuildLog.htm"
1>EdgeDetection - 1 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
1>c:\bc5\00 msim 695 testing\edd\edgedetection\edgedetection\edgedetection.cpp(1) : warning C4005: 'UNICODE' : macro redefinition
1>        command-line arguments : see previous definition of 'UNICODE'
1>c:\bc5\00 msim 695 testing\edd\edgedetection\edgedetection\edgedetection.cpp(2) : fatal error C1083: Cannot open include file: 'windows.h': No such file or directory
1>Build log was saved at "file://c:\BC5\00 MSIM 695 Testing\EDd\EdgeDetection\EdgeDetection\Debug\BuildLog.htm"
1>EdgeDetection - 1 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

1>c:\bc5\00 msim 695 testing\edd\edgedetection\edgedetection\edgedetection.cpp(1) : warning C4005: 'UNICODE' : macro redefinition
1>        command-line arguments : see previous definition of 'UNICODE'
1>c:\bc5\00 msim 695 testing\edd\edgedetection\edgedetection\edgedetection.cpp(2) : fatal error C1083: Cannot open include file: 'windows.h': No such file or directory
1>Build log was saved at "file://c:\BC5\00 MSIM 695 Testing\EDd\EdgeDetection\EdgeDetection\Debug\BuildLog.htm"
1>EdgeDetection - 1 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


How do I fix it?

Meanwhile, I continue looking into the other 3 links.

EEH
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:ExpExchHelp
ID: 20118102
I don't know which the error/warning was copied 3 times.    This is what I have:

1>c:\bc5\00 msim 695 testing\edd\edgedetection\edgedetection\edgedetection.cpp(1) : warning C4005: 'UNICODE' : macro redefinition
1>        command-line arguments : see previous definition of 'UNICODE'
1>c:\bc5\00 msim 695 testing\edd\edgedetection\edgedetection\edgedetection.cpp(2) : fatal error C1083: Cannot open include file: 'windows.h': No such file or directory
1>Build log was saved at "file://c:\BC5\00 MSIM 695 Testing\EDd\EdgeDetection\EdgeDetection\Debug\BuildLog.htm"
1>EdgeDetection - 1 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
0
 
LVL 86

Expert Comment

by:jkr
ID: 20118358
What compiler are you using? And do you have "windows.h" somewhere on your disk?
0
 

Author Comment

by:ExpExchHelp
ID: 20118384
I use "Visual C++ Express Edition".    No, I don't think I have Windows.h on my machine.

Where do I get Windows.h?   Where would I place the file?

EEH
0
 
LVL 86

Assisted Solution

by:jkr
jkr earned 1200 total points
ID: 20118392
Then you need the Platform SDK from http://www.microsoft.com/downloads/details.aspx?FamilyId=A55B6B43-E24F-4EA3-A93E-40C0EC4F68E5&displaylang=en ("Windows® Server 2003 SP1 Platform SDK Web Install"). Don't get confused by the name, it is the most recent one. Then, read http://msdn2.microsoft.com/en-us/express/aa700755.aspx ("Using Visual C++ 2005 Express Edition with the Microsoft Platform SDK") and follow the instructions there.
0
 

Author Comment

by:ExpExchHelp
ID: 20118541
Ok, I'm about to download the "Windows® Server 2003 SP1 Platform SDK Web Install"

There are 3 files I could choose from:
PSDK-amd64.exe
PSDK-ia64.exe
PSDK-x86.exe
 
I run Windows XP... which one would you recommend?

EEH
0
 
LVL 86

Expert Comment

by:jkr
ID: 20118560
PSDK-x86.exe is the one you need.
0
 

Author Comment

by:ExpExchHelp
ID: 20118716
jkr,

I installed the (huge) PSDK-x86.exe file.   I then ran the CPP program in Visual Studio again... I still get the same error/warning.

Read some of the 2nd link.  Not sure if this will make a difference.

I'm still lost here.

EEH

0
 
LVL 86

Expert Comment

by:jkr
ID: 20118747
Add the directory where you now locate 'windows.h' to the 'Additional Include Directories' section of your project properties (under "Preprcessor"), then the compiler will find the necessary files.
0
 

Author Comment

by:ExpExchHelp
ID: 20118771
Wow... I probably looked at half a dozen different project properties.   I could not find the specific locations for "Additional Include Directories".    Could you pls provide the specific menu/submenu where to locate this property?

Please bare w/ me on this.  
0
 
LVL 86

Assisted Solution

by:jkr
jkr earned 1200 total points
ID: 20118914
Hm, I don't know the Express edition, but right-clicking on the solution in the left hand pane and selecting "Properties", that will open the project properties. There, go to "C++|Preprocessor" and you should be there. Alternatively, you could set that under "Tools|Options", so that is added for all future projects also.
0
 
LVL 86

Expert Comment

by:jkr
ID: 20118945
BTW, if you cannot find anything there, create an environment variable called "INCLUDE" and set the path there, then restart Visual Studio.
0
 
LVL 2

Assisted Solution

by:AshvinPatel
AshvinPatel earned 400 total points
ID: 20130549
checkout http://www.cs.cmu.edu/~cil/v-source.html for edge detection algorithms.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question