cvmat to float

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

cvmat to float

opencv-users mailing list
Hello freinds, how can tell me how can i convet from cvmat to float ?
 and thank you in advance.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: cvmat to float

opencv-users mailing list
Hello there.

I think you'd like to get the data of your Mat, you simply do:

float * floatData = reinterpret_cast<float*>(myMat.data);

Regards,

Fábián Kristóf

To: [hidden email]
From: [hidden email]
Date: Mon, 18 Jan 2016 06:13:45 -0800
Subject: [OpenCV] cvmat to float














 

 



 


   
     
     
     
Hello freinds, how can tell me how can i convet from cvmat to float ?
and thank you in advance.



   
     

   
   






       
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: cvmat to float

opencv-users mailing list
In reply to this post by opencv-users mailing list
I'm changing my code from opencv c code to cuda coda and cuda works only with float an int, so i'm obliged to change it from cvmat to float. thank you all.

    On Monday, January 18, 2016 3:13 PM, "[hidden email] [OpenCV]" <[hidden email]> wrote:
 

     Hello freinds, how can tell me how can i convet from cvmat to float ?and thank you in advance.  #yiv4406273287 #yiv4406273287 -- #yiv4406273287ygrp-mkp {border:1px solid #d8d8d8;font-family:Arial;margin:10px 0;padding:0 10px;}#yiv4406273287 #yiv4406273287ygrp-mkp hr {border:1px solid #d8d8d8;}#yiv4406273287 #yiv4406273287ygrp-mkp #yiv4406273287hd {color:#628c2a;font-size:85%;font-weight:700;line-height:122%;margin:10px 0;}#yiv4406273287 #yiv4406273287ygrp-mkp #yiv4406273287ads {margin-bottom:10px;}#yiv4406273287 #yiv4406273287ygrp-mkp .yiv4406273287ad {padding:0 0;}#yiv4406273287 #yiv4406273287ygrp-mkp .yiv4406273287ad p {margin:0;}#yiv4406273287 #yiv4406273287ygrp-mkp .yiv4406273287ad a {color:#0000ff;text-decoration:none;}#yiv4406273287 #yiv4406273287ygrp-sponsor #yiv4406273287ygrp-lc {font-family:Arial;}#yiv4406273287 #yiv4406273287ygrp-sponsor #yiv4406273287ygrp-lc #yiv4406273287hd {margin:10px 0px;font-weight:700;font-size:78%;line-height:122%;}#yiv4406273287 #yiv4406273287ygrp-sponsor #yiv4406273287ygrp-lc .yiv4406273287ad {margin-bottom:10px;padding:0 0;}#yiv4406273287 #yiv4406273287actions {font-family:Verdana;font-size:11px;padding:10px 0;}#yiv4406273287 #yiv4406273287activity {background-color:#e0ecee;float:left;font-family:Verdana;font-size:10px;padding:10px;}#yiv4406273287 #yiv4406273287activity span {font-weight:700;}#yiv4406273287 #yiv4406273287activity span:first-child {text-transform:uppercase;}#yiv4406273287 #yiv4406273287activity span a {color:#5085b6;text-decoration:none;}#yiv4406273287 #yiv4406273287activity span span {color:#ff7900;}#yiv4406273287 #yiv4406273287activity span .yiv4406273287underline {text-decoration:underline;}#yiv4406273287 .yiv4406273287attach {clear:both;display:table;font-family:Arial;font-size:12px;padding:10px 0;width:400px;}#yiv4406273287 .yiv4406273287attach div a {text-decoration:none;}#yiv4406273287 .yiv4406273287attach img {border:none;padding-right:5px;}#yiv4406273287 .yiv4406273287attach label {display:block;margin-bottom:5px;}#yiv4406273287 .yiv4406273287attach label a {text-decoration:none;}#yiv4406273287 blockquote {margin:0 0 0 4px;}#yiv4406273287 .yiv4406273287bold {font-family:Arial;font-size:13px;font-weight:700;}#yiv4406273287 .yiv4406273287bold a {text-decoration:none;}#yiv4406273287 dd.yiv4406273287last p a {font-family:Verdana;font-weight:700;}#yiv4406273287 dd.yiv4406273287last p span {margin-right:10px;font-family:Verdana;font-weight:700;}#yiv4406273287 dd.yiv4406273287last p span.yiv4406273287yshortcuts {margin-right:0;}#yiv4406273287 div.yiv4406273287attach-table div div a {text-decoration:none;}#yiv4406273287 div.yiv4406273287attach-table {width:400px;}#yiv4406273287 div.yiv4406273287file-title a, #yiv4406273287 div.yiv4406273287file-title a:active, #yiv4406273287 div.yiv4406273287file-title a:hover, #yiv4406273287 div.yiv4406273287file-title a:visited {text-decoration:none;}#yiv4406273287 div.yiv4406273287photo-title a, #yiv4406273287 div.yiv4406273287photo-title a:active, #yiv4406273287 div.yiv4406273287photo-title a:hover, #yiv4406273287 div.yiv4406273287photo-title a:visited {text-decoration:none;}#yiv4406273287 div#yiv4406273287ygrp-mlmsg #yiv4406273287ygrp-msg p a span.yiv4406273287yshortcuts {font-family:Verdana;font-size:10px;font-weight:normal;}#yiv4406273287 .yiv4406273287green {color:#628c2a;}#yiv4406273287 .yiv4406273287MsoNormal {margin:0 0 0 0;}#yiv4406273287 o {font-size:0;}#yiv4406273287 #yiv4406273287photos div {float:left;width:72px;}#yiv4406273287 #yiv4406273287photos div div {border:1px solid #666666;height:62px;overflow:hidden;width:62px;}#yiv4406273287 #yiv4406273287photos div label {color:#666666;font-size:10px;overflow:hidden;text-align:center;white-space:nowrap;width:64px;}#yiv4406273287 #yiv4406273287reco-category {font-size:77%;}#yiv4406273287 #yiv4406273287reco-desc {font-size:77%;}#yiv4406273287 .yiv4406273287replbq {margin:4px;}#yiv4406273287 #yiv4406273287ygrp-actbar div a:first-child {margin-right:2px;padding-right:5px;}#yiv4406273287 #yiv4406273287ygrp-mlmsg {font-size:13px;font-family:Arial, helvetica, clean, sans-serif;}#yiv4406273287 #yiv4406273287ygrp-mlmsg table {font-size:inherit;font:100%;}#yiv4406273287 #yiv4406273287ygrp-mlmsg select, #yiv4406273287 input, #yiv4406273287 textarea {font:99% Arial, Helvetica, clean, sans-serif;}#yiv4406273287 #yiv4406273287ygrp-mlmsg pre, #yiv4406273287 code {font:115% monospace;}#yiv4406273287 #yiv4406273287ygrp-mlmsg * {line-height:1.22em;}#yiv4406273287 #yiv4406273287ygrp-mlmsg #yiv4406273287logo {padding-bottom:10px;}#yiv4406273287 #yiv4406273287ygrp-msg p a {font-family:Verdana;}#yiv4406273287 #yiv4406273287ygrp-msg p#yiv4406273287attach-count span {color:#1E66AE;font-weight:700;}#yiv4406273287 #yiv4406273287ygrp-reco #yiv4406273287reco-head {color:#ff7900;font-weight:700;}#yiv4406273287 #yiv4406273287ygrp-reco {margin-bottom:20px;padding:0px;}#yiv4406273287 #yiv4406273287ygrp-sponsor #yiv4406273287ov li a {font-size:130%;text-decoration:none;}#yiv4406273287 #yiv4406273287ygrp-sponsor #yiv4406273287ov li {font-size:77%;list-style-type:square;padding:6px 0;}#yiv4406273287 #yiv4406273287ygrp-sponsor #yiv4406273287ov ul {margin:0;padding:0 0 0 8px;}#yiv4406273287 #yiv4406273287ygrp-text {font-family:Georgia;}#yiv4406273287 #yiv4406273287ygrp-text p {margin:0 0 1em 0;}#yiv4406273287 #yiv4406273287ygrp-text tt {font-size:120%;}#yiv4406273287 #yiv4406273287ygrp-vital ul li:last-child {border-right:none !important;}#yiv4406273287

 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: cvmat to float

opencv-users mailing list
myMat.convertTo(myMat32f, CV_32F);
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: cvmat to float

opencv-users mailing list
In reply to this post by opencv-users mailing list
Read my solution, it's simply: float* data = reinterpret_cast<float*>(myMat.data);

To: [hidden email]
From: [hidden email]
Date: Wed, 20 Jan 2016 09:31:53 +0000
Subject: Re: [OpenCV] cvmat to float














 

 



 


   
     
     
     
I'm changing my code from opencv c code to cuda coda and cuda works only with float an int, so i'm obliged to change it from cvmat to float. thank you all.

    On Monday, January 18, 2016 3:13 PM, "[hidden email] [OpenCV]" <[hidden email]> wrote:
 

 
 



 


   
     
     
      Hello freinds, how can tell me how can i convet from cvmat to float ?and thank you in advance.

   
     

   
   




     


   
     

   
   






       
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: cvmat to float

opencv-users mailing list
In reply to this post by opencv-users mailing list
thanks for your replies but i'm working with CvMat and not MyMat ,when i compile the program it gives "it have no membre convert to in the class CvMat " .thank you .

    On Wednesday, January 20, 2016 5:34 PM, "Bob Davies [hidden email] [OpenCV]" <[hidden email]> wrote:
 

     myMat.convertTo(myMat32f, CV_32F);  #yiv6932166939 #yiv6932166939 -- #yiv6932166939ygrp-mkp {border:1px solid #d8d8d8;font-family:Arial;margin:10px 0;padding:0 10px;}#yiv6932166939 #yiv6932166939ygrp-mkp hr {border:1px solid #d8d8d8;}#yiv6932166939 #yiv6932166939ygrp-mkp #yiv6932166939hd {color:#628c2a;font-size:85%;font-weight:700;line-height:122%;margin:10px 0;}#yiv6932166939 #yiv6932166939ygrp-mkp #yiv6932166939ads {margin-bottom:10px;}#yiv6932166939 #yiv6932166939ygrp-mkp .yiv6932166939ad {padding:0 0;}#yiv6932166939 #yiv6932166939ygrp-mkp .yiv6932166939ad p {margin:0;}#yiv6932166939 #yiv6932166939ygrp-mkp .yiv6932166939ad a {color:#0000ff;text-decoration:none;}#yiv6932166939 #yiv6932166939ygrp-sponsor #yiv6932166939ygrp-lc {font-family:Arial;}#yiv6932166939 #yiv6932166939ygrp-sponsor #yiv6932166939ygrp-lc #yiv6932166939hd {margin:10px 0px;font-weight:700;font-size:78%;line-height:122%;}#yiv6932166939 #yiv6932166939ygrp-sponsor #yiv6932166939ygrp-lc .yiv6932166939ad {margin-bottom:10px;padding:0 0;}#yiv6932166939 #yiv6932166939actions {font-family:Verdana;font-size:11px;padding:10px 0;}#yiv6932166939 #yiv6932166939activity {background-color:#e0ecee;float:left;font-family:Verdana;font-size:10px;padding:10px;}#yiv6932166939 #yiv6932166939activity span {font-weight:700;}#yiv6932166939 #yiv6932166939activity span:first-child {text-transform:uppercase;}#yiv6932166939 #yiv6932166939activity span a {color:#5085b6;text-decoration:none;}#yiv6932166939 #yiv6932166939activity span span {color:#ff7900;}#yiv6932166939 #yiv6932166939activity span .yiv6932166939underline {text-decoration:underline;}#yiv6932166939 .yiv6932166939attach {clear:both;display:table;font-family:Arial;font-size:12px;padding:10px 0;width:400px;}#yiv6932166939 .yiv6932166939attach div a {text-decoration:none;}#yiv6932166939 .yiv6932166939attach img {border:none;padding-right:5px;}#yiv6932166939 .yiv6932166939attach label {display:block;margin-bottom:5px;}#yiv6932166939 .yiv6932166939attach label a {text-decoration:none;}#yiv6932166939 blockquote {margin:0 0 0 4px;}#yiv6932166939 .yiv6932166939bold {font-family:Arial;font-size:13px;font-weight:700;}#yiv6932166939 .yiv6932166939bold a {text-decoration:none;}#yiv6932166939 dd.yiv6932166939last p a {font-family:Verdana;font-weight:700;}#yiv6932166939 dd.yiv6932166939last p span {margin-right:10px;font-family:Verdana;font-weight:700;}#yiv6932166939 dd.yiv6932166939last p span.yiv6932166939yshortcuts {margin-right:0;}#yiv6932166939 div.yiv6932166939attach-table div div a {text-decoration:none;}#yiv6932166939 div.yiv6932166939attach-table {width:400px;}#yiv6932166939 div.yiv6932166939file-title a, #yiv6932166939 div.yiv6932166939file-title a:active, #yiv6932166939 div.yiv6932166939file-title a:hover, #yiv6932166939 div.yiv6932166939file-title a:visited {text-decoration:none;}#yiv6932166939 div.yiv6932166939photo-title a, #yiv6932166939 div.yiv6932166939photo-title a:active, #yiv6932166939 div.yiv6932166939photo-title a:hover, #yiv6932166939 div.yiv6932166939photo-title a:visited {text-decoration:none;}#yiv6932166939 div#yiv6932166939ygrp-mlmsg #yiv6932166939ygrp-msg p a span.yiv6932166939yshortcuts {font-family:Verdana;font-size:10px;font-weight:normal;}#yiv6932166939 .yiv6932166939green {color:#628c2a;}#yiv6932166939 .yiv6932166939MsoNormal {margin:0 0 0 0;}#yiv6932166939 o {font-size:0;}#yiv6932166939 #yiv6932166939photos div {float:left;width:72px;}#yiv6932166939 #yiv6932166939photos div div {border:1px solid #666666;height:62px;overflow:hidden;width:62px;}#yiv6932166939 #yiv6932166939photos div label {color:#666666;font-size:10px;overflow:hidden;text-align:center;white-space:nowrap;width:64px;}#yiv6932166939 #yiv6932166939reco-category {font-size:77%;}#yiv6932166939 #yiv6932166939reco-desc {font-size:77%;}#yiv6932166939 .yiv6932166939replbq {margin:4px;}#yiv6932166939 #yiv6932166939ygrp-actbar div a:first-child {margin-right:2px;padding-right:5px;}#yiv6932166939 #yiv6932166939ygrp-mlmsg {font-size:13px;font-family:Arial, helvetica, clean, sans-serif;}#yiv6932166939 #yiv6932166939ygrp-mlmsg table {font-size:inherit;font:100%;}#yiv6932166939 #yiv6932166939ygrp-mlmsg select, #yiv6932166939 input, #yiv6932166939 textarea {font:99% Arial, Helvetica, clean, sans-serif;}#yiv6932166939 #yiv6932166939ygrp-mlmsg pre, #yiv6932166939 code {font:115% monospace;}#yiv6932166939 #yiv6932166939ygrp-mlmsg * {line-height:1.22em;}#yiv6932166939 #yiv6932166939ygrp-mlmsg #yiv6932166939logo {padding-bottom:10px;}#yiv6932166939 #yiv6932166939ygrp-msg p a {font-family:Verdana;}#yiv6932166939 #yiv6932166939ygrp-msg p#yiv6932166939attach-count span {color:#1E66AE;font-weight:700;}#yiv6932166939 #yiv6932166939ygrp-reco #yiv6932166939reco-head {color:#ff7900;font-weight:700;}#yiv6932166939 #yiv6932166939ygrp-reco {margin-bottom:20px;padding:0px;}#yiv6932166939 #yiv6932166939ygrp-sponsor #yiv6932166939ov li a {font-size:130%;text-decoration:none;}#yiv6932166939 #yiv6932166939ygrp-sponsor #yiv6932166939ov li {font-size:77%;list-style-type:square;padding:6px 0;}#yiv6932166939 #yiv6932166939ygrp-sponsor #yiv6932166939ov ul {margin:0;padding:0 0 0 8px;}#yiv6932166939 #yiv6932166939ygrp-text {font-family:Georgia;}#yiv6932166939 #yiv6932166939ygrp-text p {margin:0 0 1em 0;}#yiv6932166939 #yiv6932166939ygrp-text tt {font-size:120%;}#yiv6932166939 #yiv6932166939ygrp-vital ul li:last-child {border-right:none !important;}#yiv6932166939

 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: cvmat to float

opencv-users mailing list
MyMat is the variable name, not the type. So, to be more clear:

CvMat myMat;
// set myMat data..
// and then

float* myMatFloatData = reinterpret_cast<float*>(myMat);

To: [hidden email]
From: [hidden email]
Date: Thu, 21 Jan 2016 09:43:29 +0000
Subject: Re: [OpenCV] cvmat to float














 

 



 


   
     
     
     
thanks for your replies but i'm working with CvMat and not MyMat ,when i compile the program it gives "it have no membre convert to in the class CvMat " .thank you .

    On Wednesday, January 20, 2016 5:34 PM, "Bob Davies [hidden email] [OpenCV]" <[hidden email]> wrote:
 

 
 



 


   
     
     
      myMat.convertTo(myMat32f, CV_32F);


   
     

   
   




     


   
     

   
   






       
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: cvmat to float

opencv-users mailing list
thank you for your time that's kind of you .have a nice day.

    On Thursday, January 21, 2016 11:12 AM, "Fábián Kristóf - Szabolcs [hidden email] [OpenCV]" <[hidden email]> wrote:
 

     MyMat is the variable name, not the type. So, to be more clear:

CvMat myMat;
// set myMat data..
// and then

float* myMatFloatData = reinterpret_cast<float*>(myMat);

To: [hidden email]
From: [hidden email]
Date: Thu, 21 Jan 2016 09:43:29 +0000
Subject: Re: [OpenCV] cvmat to float

    
thanks for your replies but i'm working with CvMat and not MyMat ,when i compile the program it gives "it have no membre convert to in the class CvMat " .thank you .

    On Wednesday, January 20, 2016 5:34 PM, "Bob Davies [hidden email] [OpenCV]" <[hidden email]> wrote:
 

     myMat.convertTo(myMat32f, CV_32F);  

   
      #yiv6063429645 #yiv6063429645 -- #yiv6063429645ygrp-mkp {border:1px solid #d8d8d8;font-family:Arial;margin:10px 0;padding:0 10px;}#yiv6063429645 #yiv6063429645ygrp-mkp hr {border:1px solid #d8d8d8;}#yiv6063429645 #yiv6063429645ygrp-mkp #yiv6063429645hd {color:#628c2a;font-size:85%;font-weight:700;line-height:122%;margin:10px 0;}#yiv6063429645 #yiv6063429645ygrp-mkp #yiv6063429645ads {margin-bottom:10px;}#yiv6063429645 #yiv6063429645ygrp-mkp .yiv6063429645ad {padding:0 0;}#yiv6063429645 #yiv6063429645ygrp-mkp .yiv6063429645ad p {margin:0;}#yiv6063429645 #yiv6063429645ygrp-mkp .yiv6063429645ad a {color:#0000ff;text-decoration:none;}#yiv6063429645 #yiv6063429645ygrp-sponsor #yiv6063429645ygrp-lc {font-family:Arial;}#yiv6063429645 #yiv6063429645ygrp-sponsor #yiv6063429645ygrp-lc #yiv6063429645hd {margin:10px 0px;font-weight:700;font-size:78%;line-height:122%;}#yiv6063429645 #yiv6063429645ygrp-sponsor #yiv6063429645ygrp-lc .yiv6063429645ad {margin-bottom:10px;padding:0 0;}#yiv6063429645 #yiv6063429645actions {font-family:Verdana;font-size:11px;padding:10px 0;}#yiv6063429645 #yiv6063429645activity {background-color:#e0ecee;float:left;font-family:Verdana;font-size:10px;padding:10px;}#yiv6063429645 #yiv6063429645activity span {font-weight:700;}#yiv6063429645 #yiv6063429645activity span:first-child {text-transform:uppercase;}#yiv6063429645 #yiv6063429645activity span a {color:#5085b6;text-decoration:none;}#yiv6063429645 #yiv6063429645activity span span {color:#ff7900;}#yiv6063429645 #yiv6063429645activity span .yiv6063429645underline {text-decoration:underline;}#yiv6063429645 .yiv6063429645attach {clear:both;display:table;font-family:Arial;font-size:12px;padding:10px 0;width:400px;}#yiv6063429645 .yiv6063429645attach div a {text-decoration:none;}#yiv6063429645 .yiv6063429645attach img {border:none;padding-right:5px;}#yiv6063429645 .yiv6063429645attach label {display:block;margin-bottom:5px;}#yiv6063429645 .yiv6063429645attach label a {text-decoration:none;}#yiv6063429645 blockquote {margin:0 0 0 4px;}#yiv6063429645 .yiv6063429645bold {font-family:Arial;font-size:13px;font-weight:700;}#yiv6063429645 .yiv6063429645bold a {text-decoration:none;}#yiv6063429645 dd.yiv6063429645last p a {font-family:Verdana;font-weight:700;}#yiv6063429645 dd.yiv6063429645last p span {margin-right:10px;font-family:Verdana;font-weight:700;}#yiv6063429645 dd.yiv6063429645last p span.yiv6063429645yshortcuts {margin-right:0;}#yiv6063429645 div.yiv6063429645attach-table div div a {text-decoration:none;}#yiv6063429645 div.yiv6063429645attach-table {width:400px;}#yiv6063429645 div.yiv6063429645file-title a, #yiv6063429645 div.yiv6063429645file-title a:active, #yiv6063429645 div.yiv6063429645file-title a:hover, #yiv6063429645 div.yiv6063429645file-title a:visited {text-decoration:none;}#yiv6063429645 div.yiv6063429645photo-title a, #yiv6063429645 div.yiv6063429645photo-title a:active, #yiv6063429645 div.yiv6063429645photo-title a:hover, #yiv6063429645 div.yiv6063429645photo-title a:visited {text-decoration:none;}#yiv6063429645 div#yiv6063429645ygrp-mlmsg #yiv6063429645ygrp-msg p a span.yiv6063429645yshortcuts {font-family:Verdana;font-size:10px;font-weight:normal;}#yiv6063429645 .yiv6063429645green {color:#628c2a;}#yiv6063429645 .yiv6063429645MsoNormal {margin:0 0 0 0;}#yiv6063429645 o {font-size:0;}#yiv6063429645 #yiv6063429645photos div {float:left;width:72px;}#yiv6063429645 #yiv6063429645photos div div {border:1px solid #666666;height:62px;overflow:hidden;width:62px;}#yiv6063429645 #yiv6063429645photos div label {color:#666666;font-size:10px;overflow:hidden;text-align:center;white-space:nowrap;width:64px;}#yiv6063429645 #yiv6063429645reco-category {font-size:77%;}#yiv6063429645 #yiv6063429645reco-desc {font-size:77%;}#yiv6063429645 .yiv6063429645replbq {margin:4px;}#yiv6063429645 #yiv6063429645ygrp-actbar div a:first-child {margin-right:2px;padding-right:5px;}#yiv6063429645 #yiv6063429645ygrp-mlmsg {font-size:13px;font-family:Arial, helvetica, clean, sans-serif;}#yiv6063429645 #yiv6063429645ygrp-mlmsg table {font-size:inherit;font:100%;}#yiv6063429645 #yiv6063429645ygrp-mlmsg select, #yiv6063429645 input, #yiv6063429645 textarea {font:99% Arial, Helvetica, clean, sans-serif;}#yiv6063429645 #yiv6063429645ygrp-mlmsg pre, #yiv6063429645 code {font:115% monospace;}#yiv6063429645 #yiv6063429645ygrp-mlmsg * {line-height:1.22em;}#yiv6063429645 #yiv6063429645ygrp-mlmsg #yiv6063429645logo {padding-bottom:10px;}#yiv6063429645 #yiv6063429645ygrp-msg p a {font-family:Verdana;}#yiv6063429645 #yiv6063429645ygrp-msg p#yiv6063429645attach-count span {color:#1E66AE;font-weight:700;}#yiv6063429645 #yiv6063429645ygrp-reco #yiv6063429645reco-head {color:#ff7900;font-weight:700;}#yiv6063429645 #yiv6063429645ygrp-reco {margin-bottom:20px;padding:0px;}#yiv6063429645 #yiv6063429645ygrp-sponsor #yiv6063429645ov li a {font-size:130%;text-decoration:none;}#yiv6063429645 #yiv6063429645ygrp-sponsor #yiv6063429645ov li {font-size:77%;list-style-type:square;padding:6px 0;}#yiv6063429645 #yiv6063429645ygrp-sponsor #yiv6063429645ov ul {margin:0;padding:0 0 0 8px;}#yiv6063429645 #yiv6063429645ygrp-text {font-family:Georgia;}#yiv6063429645 #yiv6063429645ygrp-text p {margin:0 0 1em 0;}#yiv6063429645 #yiv6063429645ygrp-text tt {font-size:120%;}#yiv6063429645 #yiv6063429645ygrp-vital ul li:last-child {border-right:none !important;}#yiv6063429645

 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: cvmat to float

opencv-users mailing list
Sorry, actually there's a mistake, it should be:

float* myMatFloatData = reinterpret_cast<float*>(myMat.data); //data holds the pointer to your datas

You're welcome, I'm glad that I could help you! :)

To: [hidden email]
From: [hidden email]
Date: Thu, 21 Jan 2016 10:34:01 +0000
Subject: Re: [OpenCV] cvmat to float














 

 



 


   
     
     
     
thank you for your time that's kind of you .have a nice day.

    On Thursday, January 21, 2016 11:12 AM, "Fábián Kristóf - Szabolcs [hidden email] [OpenCV]" <[hidden email]> wrote:
 

 
 



 


   
     
     
     

MyMat is the variable name, not the type. So, to be more clear:CvMat myMat;// set myMat data..// and thenfloat* myMatFloatData = reinterpret_cast<float*>(myMat);To: [hidden email]: [hidden email]: Thu, 21 Jan 2016 09:43:29 +0000Subject: Re: [OpenCV] cvmat to float












 

 



 


   
     
     
      thanks for your replies but i'm working with CvMat and not MyMat ,when i compile the program it gives "it have no membre convert to in the class CvMat " .thank you .     On Wednesday, January 20, 2016 5:34 PM, "Bob Davies [hidden email] [OpenCV]" <[hidden email]> wrote:  
 



 


   
     
     
      myMat.convertTo(myMat32f, CV_32F);


   
     

   
   


     

   
     

   
   






       


   
     

   
   




     


   
     

   
   






       
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: cvmat to float

opencv-users mailing list
hear is the code i have some mistakes actually /* example1.cpp : Defines the entry point for the console application.*///#include "stdafx.h"#include <cv.h>#include <highgui.h> #include <iostream>#include <cxcore.h>#include <iostream>#include <opencv2/core/core.hpp>#include <opencv2/highgui/highgui.hpp>using namespace cv;using namespace std;

 void sommeImage(IplImage* images,/*,IplImage* image2,IplImage* image3,IplImage* image4,IplImage* image5,IplImage* image6,IplImage* image7,*/ int h, int w, CvMat* sum, CvMat* sqsum) {   cvmSet(sum, 0, 0, cvGet2D(images, 0, 0).val[0]); cvmSet(sqsum, 0, 0, cvGet2D(images, 0, 0).val[0]*cvGet2D(images, 0, 0).val[0]);   //Remplissage de la première colonne : for (int y=1;y<h;y++) {     cvmSet(sum, y, 0, cvGet2D(images, y, 0).val[0]+cvmGet(sum, y-1, 0));        cvmSet(sqsum, y, 0, cvGet2D(images, y, 0).val[0]*cvGet2D(images, y, 0).val[0]+cvmGet(sqsum, y-1, 0)); } //Remplissage de la première ligne : for (int x=1;x<w;x++) {     cvmSet(sum, 0, x, cvGet2D(images, 0, x).val[0]+cvmGet(sum, 0, x-1)); cvmSet(sqsum, 0, x, cvGet2D(images, 0, x).val[0] * cvGet2D(images, 0, x).val[0]+cvmGet(sqsum, 0, x-1)); }  // Calcul sur les autres pixels : for (int y=1;y<h;y++) { for (int x=1;x<w;x++) {     cvmSet(sum, y, x, cvGet2D(images, y, x).val[0]+cvmGet(sum, y, x-1)+cvmGet(sum, y-1, x)-cvmGet(sum, y-1, x-1));         cvmSet(sqsum, y, x, cvGet2D(images, y, x).val[0]*cvGet2D(images, y, x).val[0]+cvmGet(sqsum, y, x-1)+cvmGet(sqsum, y-1, x)-cvmGet(sqsum, y-1, x-1));      } }
 }
int main(int argc, char** argv) {    IplImage* images; /*IplImage* image2; IplImage* image3; IplImage* image4; IplImage* image5; IplImage* image6; IplImage* image7;*/
    images= cvLoadImage("images.jpg", CV_LOAD_IMAGE_GRAYSCALE);
    if(!images )    {        cout << "Could not open or find the image" << std::endl;        return -1;    }   // Caractéristiques de l'image :    int h = images->height;      int w = images->width;  /* CvMat* sum;   CvMat* sqsum;*/  /*CvMat* sum = cvCreateMat(h+1, w+1, CV_32F);   CvMat* sqsum = cvCreateMat(h+1, w+1, CV_32F);*/      CvMat* sum;float* sumFloatData = reinterpret_cast<float*>(sum.data);// conversion de CvMat* vers floatCvMat* sqsum;float* sqsumFloatData = reinterpret_cast<float*>(sqsum.data);// conversion de CvMat* vers floatsommeImage(images,/*,image2,image3,image4,image5,image6,image7,*/h, w, sum,sqsum);   Mat I=imread ("images.jpg", CV_LOAD_IMAGE_GRAYSCALE); int rows; int cols;
 for (int i = 0; i < I.rows; ++i) {        for (int j = 0; j < I.cols; ++j)        {        cout << cvGet2D(images, i, j).val[0]<<"|";        }       cout << endl; }    cout << "*****SUM *****";   cout << endl;      for(int i = 0; i < I.rows; ++i)    {       for(int j = 0; j < I.cols; ++j)       {    cout << cvmGet(sum, i, j)<<"|";        }       cout << endl;  }    cout << "*****SQSUM *****";   cout << endl;
   for(int i = 0; i < I.rows; ++i)    {       for(int j = 0; j < I.cols; ++j)       {    cout << cvmGet(sqsum, i, j)<<"|";        }       cout << endl;  }    cvWaitKey(0);    return 0;}


 

    On Thursday, January 21, 2016 12:23 PM, "Fábián Kristóf - Szabolcs [hidden email] [OpenCV]" <[hidden email]> wrote:
 

     Sorry, actually there's a mistake, it should be:

float* myMatFloatData = reinterpret_cast<float*>(myMat.data); //data holds the pointer to your datas

You're welcome, I'm glad that I could help you! :)

To: [hidden email]
From: [hidden email]
Date: Thu, 21 Jan 2016 10:34:01 +0000
Subject: Re: [OpenCV] cvmat to float

    
thank you for your time that's kind of you .have a nice day.

    On Thursday, January 21, 2016 11:12 AM, "Fábián Kristóf - Szabolcs [hidden email] [OpenCV]" <[hidden email]> wrote:
 

     MyMat is the variable name, not the type. So, to be more clear:

CvMat myMat;
// set myMat data..
// and then

float* myMatFloatData = reinterpret_cast<float*>(myMat);

To: [hidden email]
From: [hidden email]
Date: Thu, 21 Jan 2016 09:43:29 +0000
Subject: Re: [OpenCV] cvmat to float

    
thanks for your replies but i'm working with CvMat and not MyMat ,when i compile the program it gives "it have no membre convert to in the class CvMat " .thank you .

    On Wednesday, January 20, 2016 5:34 PM, "Bob Davies [hidden email] [OpenCV]" <[hidden email]> wrote:
 

     myMat.convertTo(myMat32f, CV_32F);  

   
     

   
      #yiv4794567085 #yiv4794567085 -- #yiv4794567085ygrp-mkp {border:1px solid #d8d8d8;font-family:Arial;margin:10px 0;padding:0 10px;}#yiv4794567085 #yiv4794567085ygrp-mkp hr {border:1px solid #d8d8d8;}#yiv4794567085 #yiv4794567085ygrp-mkp #yiv4794567085hd {color:#628c2a;font-size:85%;font-weight:700;line-height:122%;margin:10px 0;}#yiv4794567085 #yiv4794567085ygrp-mkp #yiv4794567085ads {margin-bottom:10px;}#yiv4794567085 #yiv4794567085ygrp-mkp .yiv4794567085ad {padding:0 0;}#yiv4794567085 #yiv4794567085ygrp-mkp .yiv4794567085ad p {margin:0;}#yiv4794567085 #yiv4794567085ygrp-mkp .yiv4794567085ad a {color:#0000ff;text-decoration:none;}#yiv4794567085 #yiv4794567085ygrp-sponsor #yiv4794567085ygrp-lc {font-family:Arial;}#yiv4794567085 #yiv4794567085ygrp-sponsor #yiv4794567085ygrp-lc #yiv4794567085hd {margin:10px 0px;font-weight:700;font-size:78%;line-height:122%;}#yiv4794567085 #yiv4794567085ygrp-sponsor #yiv4794567085ygrp-lc .yiv4794567085ad {margin-bottom:10px;padding:0 0;}#yiv4794567085 #yiv4794567085actions {font-family:Verdana;font-size:11px;padding:10px 0;}#yiv4794567085 #yiv4794567085activity {background-color:#e0ecee;float:left;font-family:Verdana;font-size:10px;padding:10px;}#yiv4794567085 #yiv4794567085activity span {font-weight:700;}#yiv4794567085 #yiv4794567085activity span:first-child {text-transform:uppercase;}#yiv4794567085 #yiv4794567085activity span a {color:#5085b6;text-decoration:none;}#yiv4794567085 #yiv4794567085activity span span {color:#ff7900;}#yiv4794567085 #yiv4794567085activity span .yiv4794567085underline {text-decoration:underline;}#yiv4794567085 .yiv4794567085attach {clear:both;display:table;font-family:Arial;font-size:12px;padding:10px 0;width:400px;}#yiv4794567085 .yiv4794567085attach div a {text-decoration:none;}#yiv4794567085 .yiv4794567085attach img {border:none;padding-right:5px;}#yiv4794567085 .yiv4794567085attach label {display:block;margin-bottom:5px;}#yiv4794567085 .yiv4794567085attach label a {text-decoration:none;}#yiv4794567085 blockquote {margin:0 0 0 4px;}#yiv4794567085 .yiv4794567085bold {font-family:Arial;font-size:13px;font-weight:700;}#yiv4794567085 .yiv4794567085bold a {text-decoration:none;}#yiv4794567085 dd.yiv4794567085last p a {font-family:Verdana;font-weight:700;}#yiv4794567085 dd.yiv4794567085last p span {margin-right:10px;font-family:Verdana;font-weight:700;}#yiv4794567085 dd.yiv4794567085last p span.yiv4794567085yshortcuts {margin-right:0;}#yiv4794567085 div.yiv4794567085attach-table div div a {text-decoration:none;}#yiv4794567085 div.yiv4794567085attach-table {width:400px;}#yiv4794567085 div.yiv4794567085file-title a, #yiv4794567085 div.yiv4794567085file-title a:active, #yiv4794567085 div.yiv4794567085file-title a:hover, #yiv4794567085 div.yiv4794567085file-title a:visited {text-decoration:none;}#yiv4794567085 div.yiv4794567085photo-title a, #yiv4794567085 div.yiv4794567085photo-title a:active, #yiv4794567085 div.yiv4794567085photo-title a:hover, #yiv4794567085 div.yiv4794567085photo-title a:visited {text-decoration:none;}#yiv4794567085 div#yiv4794567085ygrp-mlmsg #yiv4794567085ygrp-msg p a span.yiv4794567085yshortcuts {font-family:Verdana;font-size:10px;font-weight:normal;}#yiv4794567085 .yiv4794567085green {color:#628c2a;}#yiv4794567085 .yiv4794567085MsoNormal {margin:0 0 0 0;}#yiv4794567085 o {font-size:0;}#yiv4794567085 #yiv4794567085photos div {float:left;width:72px;}#yiv4794567085 #yiv4794567085photos div div {border:1px solid #666666;height:62px;overflow:hidden;width:62px;}#yiv4794567085 #yiv4794567085photos div label {color:#666666;font-size:10px;overflow:hidden;text-align:center;white-space:nowrap;width:64px;}#yiv4794567085 #yiv4794567085reco-category {font-size:77%;}#yiv4794567085 #yiv4794567085reco-desc {font-size:77%;}#yiv4794567085 .yiv4794567085replbq {margin:4px;}#yiv4794567085 #yiv4794567085ygrp-actbar div a:first-child {margin-right:2px;padding-right:5px;}#yiv4794567085 #yiv4794567085ygrp-mlmsg {font-size:13px;font-family:Arial, helvetica, clean, sans-serif;}#yiv4794567085 #yiv4794567085ygrp-mlmsg table {font-size:inherit;font:100%;}#yiv4794567085 #yiv4794567085ygrp-mlmsg select, #yiv4794567085 input, #yiv4794567085 textarea {font:99% Arial, Helvetica, clean, sans-serif;}#yiv4794567085 #yiv4794567085ygrp-mlmsg pre, #yiv4794567085 code {font:115% monospace;}#yiv4794567085 #yiv4794567085ygrp-mlmsg * {line-height:1.22em;}#yiv4794567085 #yiv4794567085ygrp-mlmsg #yiv4794567085logo {padding-bottom:10px;}#yiv4794567085 #yiv4794567085ygrp-msg p a {font-family:Verdana;}#yiv4794567085 #yiv4794567085ygrp-msg p#yiv4794567085attach-count span {color:#1E66AE;font-weight:700;}#yiv4794567085 #yiv4794567085ygrp-reco #yiv4794567085reco-head {color:#ff7900;font-weight:700;}#yiv4794567085 #yiv4794567085ygrp-reco {margin-bottom:20px;padding:0px;}#yiv4794567085 #yiv4794567085ygrp-sponsor #yiv4794567085ov li a {font-size:130%;text-decoration:none;}#yiv4794567085 #yiv4794567085ygrp-sponsor #yiv4794567085ov li {font-size:77%;list-style-type:square;padding:6px 0;}#yiv4794567085 #yiv4794567085ygrp-sponsor #yiv4794567085ov ul {margin:0;padding:0 0 0 8px;}#yiv4794567085 #yiv4794567085ygrp-text {font-family:Georgia;}#yiv4794567085 #yiv4794567085ygrp-text p {margin:0 0 1em 0;}#yiv4794567085 #yiv4794567085ygrp-text tt {font-size:120%;}#yiv4794567085 #yiv4794567085ygrp-vital ul li:last-child {border-right:none !important;}#yiv4794567085

 
Loading...