I'd take a spoiler for you any day.
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread Today, 10:13
Steve Warner Steve Warner is offline
Controls / Programming
FRC #0234 (Cyber Blue)
Team Role: Mentor
 
Join Date: Feb 2006
Rookie Year: 2006
Location: Indiana
Posts: 45
Steve Warner is an unknown quantity at this point
Opencv Imwrite and Copy

Does anyone know how to save a Mat image as a .jpg file in C++? We have tried imwrite but cannot get Eclipse to recognize the function.

Also is there a way to copy one Mat image to another?
Thanks
Reply With Quote
  #2   Spotlight this post!  
Unread Today, 11:11
euhlmann's Avatar
euhlmann euhlmann is offline
CTO, Programmer
AKA: Erik Uhlmann
FRC #2877 (LigerBots)
Team Role: Leadership
 
Join Date: Dec 2015
Rookie Year: 2015
Location: United States
Posts: 420
euhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud of
Re: Opencv Imwrite and Copy

Quote:
Originally Posted by Steve Warner View Post
Does anyone know how to save a Mat image as a .jpg file in C++? We have tried imwrite but cannot get Eclipse to recognize the function.

Also is there a way to copy one Mat image to another?
Thanks
Sometimes eclipse gives you fake errors in C++. Try putting in an imwrite (make sure to #include the opencv header) and actually build it, ignoring eclipse's instant feedback. Does g++ give you errors?
__________________
Creator of SmartDashboard.js, an extensible nodejs/webkit replacement for SmartDashboard


https://ligerbots.org
Reply With Quote
  #3   Spotlight this post!  
Unread Today, 11:40
ghead ghead is offline
Registered User
FRC #3103
 
Join Date: Aug 2013
Location: US
Posts: 15
ghead is an unknown quantity at this point
Re: Opencv Imwrite and Copy

We use imwrite() with no problem. As previously stated, it is likely just an Eclipse issue, or a problem with your #includes.

For copying, try clone():

Code:
cv::Mat source;
//...GrabFrame(source) or whatever...
cv::Mat dst = source.clone();
Reply With Quote
  #4   Spotlight this post!  
Unread Today, 14:41
Steve Warner Steve Warner is offline
Controls / Programming
FRC #0234 (Cyber Blue)
Team Role: Mentor
 
Join Date: Feb 2006
Rookie Year: 2006
Location: Indiana
Posts: 45
Steve Warner is an unknown quantity at this point
Re: Opencv Imwrite and Copy

Okay the clone is compiling okay and cv::imwrite("test.jpg", out_image) is also compiling. It looks like the third parameter for imwrite is not needed.
Thanks for your help. I will try this tonight.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 15:28.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi