0

I want to convert my matlab code to c code.But when i am trying to do do lots of warnings are comping in the code readiness report. Although I have sorted out a lot of issues but still there are some functions which are not supported and i need some alternative.

Kindly tell me any alternative codes for the errors.

Let me be more specific: these are the lines of the function that are causing some issue-:

  fn = fieldnames(pars); %current parametres fieldnames
  main_fn = {'algorithm'};

  pm_fn =     

     {'pm_tau','pm_window','pm_keypoints','pm_harris_prctile','pm_searchrange'};

     m_fn =    
    {'window','range','tau','epsilon','growing','init_seeds_accept',
 'seeds_accept','searchrange','searchrangeV',
   'max_candidates','vis_step','mu','csbeta','csalgorithm','grow_version'};

Now in this it is saying that code generation only supports cell operations for varargin and vararout

the error screenshotenter image description here

Zoe
  • 27,060
  • 21
  • 118
  • 148
ninja
  • 118
  • 1
  • 12
  • are you doomed to use C or would C++ be ok too? – Micka Jun 13 '15 at 10:01
  • @Micka u can write in c++ i will convert it into c – ninja Jun 13 '15 at 10:10
  • 1
    thats not what i meant opencv c++ syntax is quite close to matlab which would make it easier for you. – Micka Jun 13 '15 at 10:44
  • @Micka ok sure do it – ninja Jun 13 '15 at 11:07
  • @Micka one another thing i need to ask you how do we convert an image to double .how to change its type? in c/c++ pls tell me in both – ninja Jun 13 '15 at 11:08
  • convert image type using cv::Mat::convertto(mat, destinationType)(http://docs.opencv.org/modules/core/doc/basic_structures.html#mat-convertto), this is c++. Didn't find a C variant in the documentation. Do you really have to stick to C? – LSA Jun 13 '15 at 12:00
  • double type is CV_64F for mats – Micka Jun 13 '15 at 12:03
  • Uh, thanks, forgot to mention :-). What is SEEDs, data for a graph? Have a look at http://stackoverflow.com/questions/9250079/drawing-and-plotting-graph-in-opencv – LSA Jun 13 '15 at 12:07
  • @LSA seeds are initial correspondence seeds kindly look at this paper i am implmentatin this in real time and yes i have to stick to c [link](cftp://cmp.felk.cvut.cz/pub/cmp/articles/cech/Cech-BenCOS-CVPR-2007.pdf) – ninja Jun 13 '15 at 13:44
  • In worst case simply create a new matrix of new type and copy the values; I just skimmed the paper. You want to print the disparity image? Well then simply assign each pixel a color value depending on the distance of the x-values. – LSA Jun 13 '15 at 14:13
  • @Micka can u pls ans this new edited question – ninja Jun 25 '15 at 14:35
  • @LSA can u pls ans this new edited question – ninja Jun 25 '15 at 14:35
  • Well you have only posted snippets from the matlab code sample, where is your code, and please copy&paste the error message you get when compiling/running. – LSA Jun 29 '15 at 12:30
  • @LSA I am just asking how to write structure in matlab in different manner so that it gets converted to c code .Since c doesnt supports dynamic structures and i am getting he same error message everywhere : code generation only supports cell operations for varargin and vararout,wherever i am using curly brackets – ninja Jun 30 '15 at 12:09
  • @LSA i hope now u can see clearly whats the error – ninja Jun 30 '15 at 12:14
  • Ah sorry, now I get you. Have you had a look at [this link](http://www.mathworks.com/matlabcentral/answers/52864-cell-operations-for-varargin-and-varargout)? – LSA Jun 30 '15 at 13:16
  • @LSA i have seen it but the problem is i want to run my code in opencv so i will first convert it into c using the coder and then put the lib obtained in visual studio and then program it .I will be using it in robotics so i can matlab in any embedded board such as raspberry pie. Beacuse of the ram and other issue so that why i cant call any function from matlab the only option left is to convert the code entirely in c – ninja Jun 30 '15 at 16:56
  • May be this [question and answer](http://stackoverflow.com/questions/31647777/switch-case-with-multiple-matches-in-matlab-for-code-generation/31651295#31651295) can help you a bit for your cell arrays. – Hoki Aug 01 '15 at 16:41

0 Answers0