LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-17-2013, 12:39 PM   #1
g_paschoal
Member
 
Registered: Oct 2009
Posts: 131

Rep: Reputation: 15
Help c++ program process several templates from openCV tutorial


Hi Guys, I would like some help because I am not a c++ expert.

I ran this example tutorial from openCV

http://docs.opencv.org/trunk/doc/tut..._matching.html

It is a template matching.

I wanted to use it to find the ROI (region of interested) from car images. So I will have one input image (which is the car image) and several templates.

In this tutorial It can work with only 1 input image and 1 template. How can I make it use several templates ?

Thank for your help.

PS. I am talking about using several templates not finding multiple matches on the same image. The input image I am only interested in one ROI which is the car plate.


Thank You very much
 
Old 11-18-2013, 08:48 AM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Seems like you've compiled and used this code. So I'm confused as to what you don't understand.

Within their code:
Code:
int main( int, char** argv )
{
  /// Load image and template
  img = imread( argv[1], 1 );
  templ = imread( argv[2], 1 );
That's unchanged from their code example. The filenames for the image and template are specified as arguments to the program. They discuss the structure of the program fairly well and they talk about different images with different templates. It never says that this code is limited to one image and one template, in fact it says the opposite, and they cite two different image examples on that page.
 
Old 11-23-2013, 08:23 AM   #3
g_paschoal
Member
 
Registered: Oct 2009
Posts: 131

Original Poster
Rep: Reputation: 15
Hello rtmistler,

Thank you very much for your help.

All you said it is true. But since I am not a good programmer (Actually I am not even a developer person) and the given example it is just for 1 input image and 1 template. I am having a hard time to make it work with 1 input image and several templates. It could be passing parameters or stating the path of the images in the code. I don't care. I just would like to see an example of how that is going to work.

Specially when performing the template matching operation:


Code:
matchTemplate( img, templ, result, match_method );

If you see it is only 1 input image and 1 template.

How can I do it for 1 input image and several templates ?


AGAIN. Sorry for my ignorance.

Any help is appreciated.
Thanks
 
Old 11-25-2013, 07:39 AM   #4
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
The first argument is the image file name.

The second argument is the template.

You may be doing this because you're (1) studying image processing, (2) have a desire to manipulate images, or (3) are practicing with C++.

If (1) then I'd recommend you take the time to become more of a learned person WRT programming, because image processing algorithms are things which programming is well built to assist.

If (2) you wish to manipulate one or more images and were pointed to this utility, and now all you have to do is get it working, then once successfully compiled, the program should have a name and you call the program and give it two arguments, separated by spaces.
Code:
./program_name argument_1 argument_2
.
If (3) then I'd recommend some easier, more fundamental code examples.

It you're able to offer the path which led you to this point and what the final intentions here are, then that would make it easier for me or someone else to offer the most helpful advice.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Facing problem while running a Opencv program dibyamohanty02 Linux - Software 3 12-14-2012 04:12 AM
how to solve errors while compiling opencv program with header file? like g++ `pkg-c prithvi_patel Linux - Newbie 1 04-05-2012 02:38 AM
OpenCV - Pixel format of incoming image is unsupported by OpenCV golmschenk Programming 1 04-01-2011 12:32 PM
Failed to run the tutorial program in Anjuta + Glade matrix13 Linux - Software 0 12-26-2008 02:44 AM
source codes/tutorial guide for generating packets with flow labels using any program becky_starr Linux - Software 0 01-06-2004 04:42 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:34 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration