You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
How can I perform image preprocessing to a images ?
2 views (last 30 days)
Show older comments
Hello everyone,
I captured some images from camera. My final aim to identify the material composition from the images. However before that i need to perform some image calibration, noise removal, feature extraction , dimensionality reduction. can you please suggest some code or routine to the do these task?
Also after this task, i wanted to apply classification algorithm so it can detect the material from it
Can you guys tell me a way to do in the Matlab. Thanks a ton.
Dakota
Answers (1)
Image Analyst
on 2 Apr 2021
You have to create a canvass large enough to contain them all, like say twice as tall and as many times wide as needed. Then figure out what line of the image contains the first brown line. Then paste that onto the same line in the canvass for all images. See my copy and paste example and adapt as needed.
30 Comments
Image Analyst
on 2 Apr 2021
Because your top line of the stripe is not in the same for for every image, you can't do stitching. You basically have to do pasting where you have a huge image and just paste each individual image onto the right place on the big canvass. Let's say you have 10 images and each one is like 480 rows by 640 columns. Then you could make a blank canvass of 1000 rows by 6400 columns. Now if the first image has the stripe at line 100, and you want all stripes to be at line 300, then paste the first image with an upper left corner at (400 - 100, 1). Now if the second image has its top stripe at line 120, you'd paste that image at (400 - 120, 513). So now that image will have it's top at line 280 and the stripe will also be at line 300 just like the first image. Then continue on like that for all images. Does that make sense? If you really can't figure it out or understand it let me know.
Image Analyst
on 3 Apr 2021
Then you have to correct for distortion first, before pasting onto the canvass (using the pasting algorithm I laid out). There is a function to correct for distortion in either the Image Processing Toolbox or the Computer Vision Toolbox.
Image Analyst
on 3 Apr 2021
Image Analyst
on 3 Apr 2021
Edited: Image Analyst
on 3 Apr 2021
I don't know how they should be stitched together horizontally. You have 7 stripes in some images and only 4 in others so it's not clear what is to be aligned with what. And even if you did paste the images onto a canvass, you're not going to have 7 stripes all the way across the image.

Image Analyst
on 4 Apr 2021
All of them have 10 stripes in the image. Your input images have only 4-7 stripes. Why don't you do this. Go into Photoshop or GIMP and make a huge image, at least 3 times as tall as your image and wide enough to contain all the image. Then read in each image, select the whole image, copy it, and go back to the canvass image and paste it on there. Then flatten the image and post it back here so I can see exactly where the 4 stripe images went to and the 7 stripe images went to.
Image Analyst
on 6 Apr 2021
Do you know which filenames correspond to which position? Like is it
1 2 3 4 5
6 7 8 9 10
or is it
1 3 5 7 9
2 4 6 8 10
Dakota Warner
on 10 Apr 2021
Image Analyst
on 11 Apr 2021
Sorry but I just don't have time to do this for you. It would take more than the usual 10-20 minutes I donate to people. Good luck though.
Kristen Chappel
on 13 Apr 2021
Edited: Kristen Chappel
on 13 Apr 2021
Hey Dakota, have you solved your problem. If yes then can you explain. @Image Analyst, @Prabhan Purwar Can you try it, because i have the similar problem. Also i do have calibration dot image, so you can use it for the set compensation and then again use it for the to correct the images? is it possible with matlab code to set the model so we can correct the image by using dot grid image. You can see the dot calibration image in the attachment.
Image Analyst
on 13 Apr 2021
@Kristen Chappel, I don't see the similarity. I don't see what you're asking. What is a calibration dot image? Start your own thread.
Kristen Chappel
on 14 Apr 2021
@Image Analyst, @Prabhan Purwar Calibratio dot image used to compensate the error. So this can be used to idetify the error and later correct the images according to this error. I do have calibration dot image, so you can use it for the set compensation and then again use it for the to correct the images? is it possible with matlab code to set the model and this model we can use it to correct the images.
Dakota Warner
on 14 Apr 2021
No i did not solve the problem yet. I think dot grid is good option to identify the error and set the model to correct the images later. But, i don't know how to do it
Devyani Sankhe
on 14 Apr 2021
I am very interested in this solution, if you solved then please share the code
Kristen Chappel
on 14 Apr 2021
Hi, i am struggling to solve this problem, If anyone having solution please do share with me@Image Analyst
Image Analyst
on 15 Apr 2021
I still don't see what Kristin's dots have to do with a sequence of many images of a partial set of stripes that drifts upwards.
Kristen Chappel
on 15 Apr 2021
Hi @Image Analyst, This dot grid image be can be use it for the calibrate and set the model to remove the issue of the error.
For example something like this but with the dot image instead of checkerboard
Link https://www.mathworks.com/help/vision/ref/undistortpoints.html
Image Analyst
on 15 Apr 2021
@Kristen Chappel, OK, so it's mildly related if Dakota needs to undistort her images. I haven't used the built-in distortion correction function. I'd have to learn it just like you will and you can probably do that just as well as I can.
Kristen Chappel
on 15 Apr 2021
@Image Analyst, Thanks but i am not expert in Matlab. I tried multiple times but didnot suceed. Can you please do it. Thanks in advance.
Dakota Warner
on 15 Apr 2021
Yes @Image Analyst, it will be good option if remove the distortion. Because after distortion all the images will stiched equally. Is it possible to develop code to perform this operation? Thanks a ton.
Dakota Warner
on 17 Apr 2021
@Image AnalystCan you please develop the code, because i am not able to find any kind of solution. I am trying but still don't know how to do it. Thank a ton
Image Analyst
on 17 Apr 2021
Like I said, I'm just never going to be able to carve out enough time in my busy schedule to donate enough to you to develop a turnkey solution for you. I still have to do my regular job 10-12 hours a day, mow the lawn, do my taxes, interact with family, etc. Sorry, but I know you can do it. You are smart enough and it would be a good way to learn MATLAB better.
Dakota Warner
on 18 Apr 2021
i tried but not able to solve. I don't know from where to start. Anyway i am sorry for asking your time. You always tried to help me, that is why i asked you.
Thanks
D. Warner
Dakota Warner
on 21 Apr 2021
can you please suggest me feature based stitching code atleast. This could be also useful.
Thanks a ton
D. Warner
Image Analyst
on 21 Apr 2021
Dakota Warner
on 26 Apr 2021
@Image Analyst, In the Panorama and Image Registration - MATLAB & Simulink, it gives option for the two images stitching only. May i know how to add multiple images for stitching?
Thanks a ton
D. Warner
Image Analyst
on 26 Apr 2021
I'd just do it one pair at a time. Do 1 & 2 to get a joined image. Then do the joined image and the third image, and so on.
Image Analyst
on 26 Apr 2021
Yes, it's probably better to just spend time to code up the algorithm I laid out.
See Also
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)