Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X
Hello everybody,
I'm trying to convert matrix to (x,y,z) data set. The matrix is obtained from an image and i want to extract only certain features of that image (see mathcad file). I've menaged to do that by setting a treshold and by using binarize and scale functions. As a result matrix/image S is obtained (see mathcad file). I want to extract only those matrix elements that have value 255 and to present it as a (x,y,z) data set where x and y should correspond to index i,j of matrix S.
Indices i and j are important because they are correlated to dimensions of the flourescent screen (initial image is a snapshot of a screen) and additional mathematical operations on (i,j) i.e. (x,y) should be performed.
Thank you in advance!!!
Solved! Go to Solution.
May be this help you
http://twt.mpei.ac.ru/ochkov/Mathcad-15/SolveImage.pdf
Sorry - in Russian, but you can use the google translator
And see please this picture
I want to extract only those matrix elements that have value 255 and to present it as a (x,y,z) data set where x and y should correspond to index i,j of matrix S.
Indices i and j are important
Of course the indices would be important, as all the z values would be 255 anyway, right?
The task sure is not difficult but you would have to be more precise in respect to what way you would like the extracted data to be presented. In your matrix S there are 1008 pixels with value 255.
What should that (x,y,z) represent:
Writing your own small program gives you more control and its easier to modify if needed, but as you are interested in the indices only (data values would be 255 for all) you might consider using the match function. "match(255,S)" returns a vector of 1008 elements, each of which is a 2-element vector consisting of the indices of S, where the value 255 was found.
Look if the attched would help.
All three possibilities I could think of incorporated
Thank you guys! Richard's solution is most usable at the moment, but I am thankful for all your suggestions. I guess I'm gonna have to deal with this task a bit more, so eventually all your suggestions will be valuable for me.
Thanks again,
Goran
Goran Krstic schrieb:
Thank you guys! Richard's solution is most usable at the moment, but I am thankful for all your suggestions. I guess I'm gonna have to deal with this task a bit more, so eventually all your suggestions will be valuable for me.
Thanks again,
Goran
Richard's solution is a good one, as usual - straightforeward and short.
I just noticed that I attached the picture instead of the worksheet, which could not be very helpful - sorry!
I replaced the file for the actual worksheet in the foregoing post (http://communities.ptc.com/message/198390#198390).
Werner