1

i am trying to convert MATLAB code in java for that i am using OpenCv for android.

i want to implement this function of MATLAB in java im2double(Image). is their any ready-made function in opencv or java to do so in android. or we have to implement our own function kindly help if anyone has implemented this already. i have searched Google but didn't find any solutions.

3
  • Do you know what im2double does? Commented Apr 15, 2014 at 8:22
  • converts image to image of class double Commented Apr 15, 2014 at 8:24
  • Ok, do you know what types of images can cv::Mat hold? Commented Apr 15, 2014 at 8:27

2 Answers 2

1

Yes, you can use the equivalent to C++ Mat::convertTo() function, which is implemented in Java as

public void assignTo(Mat m, int type)

where m is the destination matrix and type is the data type/depth you want to convert your data to (in this case I think you want to use CV_64FCX, where 'X' is the number of channels).

Hope that it helps!

Sign up to request clarification or add additional context in comments.

Comments

1

http://docs.opencv.org/java/org/opencv/core/Mat.html#convertTo(org.opencv.core.Mat,%20int)

Mat someformat;    // src    
Mat doubleformat;  // dst

someformat.convertTo( doubleformat, CvType.CV_64F );

note, that this just changes the type/depth of the single elements, not the number of channels

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.