How can I use MatLab for Chroma-Keying and replacing a green background?

Click For Summary
SUMMARY

This discussion focuses on using MATLAB for chroma-keying to remove a green background and replace it with another image. The user has successfully identified pixel coordinates and calculated distances using functions like ginput and imdistline. However, they encounter an issue with matrix dimensions when attempting to manipulate pixel values in a grayscale image. The conversation highlights the need for specific MATLAB functions and techniques to achieve effective background replacement.

PREREQUISITES
  • Familiarity with MATLAB image processing functions such as im2double, ginput, and imdistline.
  • Understanding of pixel manipulation and matrix dimensions in MATLAB.
  • Basic knowledge of chroma-keying techniques in image processing.
  • Experience with image calibration and superimposing images in MATLAB.
NEXT STEPS
  • Research MATLAB's image processing toolbox for advanced functions related to chroma-keying.
  • Learn about MATLAB's logical indexing to manipulate pixel values effectively.
  • Explore tutorials on image calibration techniques using MATLAB.
  • Investigate error handling in MATLAB to troubleshoot matrix dimension issues.
USEFUL FOR

This discussion is beneficial for biology students, image processing enthusiasts, and MATLAB users looking to implement chroma-keying techniques for background replacement in images.

1Keenan
Messages
99
Reaction score
4
Hi,

I have an image (attached) I have to use as a reference.
To be clear I have to use this grid as calibration for an acquisition sistem.

I want to get the grid of this image and superimpose it on other images.
Is it possible? how to do it?

Thanks
 

Attachments

  • Calibrazione170112.jpg
    Calibrazione170112.jpg
    30.1 KB · Views: 687
Physics news on Phys.org
I managed to get the central pixel coordinates [X0,Y0] (using ginput) and the distance between two points (using imdistline).
I have converted the image in a gray scale using im2double and I want to change pixel value in the first quadrant. (image is almost black)
I mean I would like to set as white each pixel of every rows between 1 and Y0 with step equal to the distance calculated above and do the same for the column between X0 and 821.
How to do that?
(the image size is 577X821X3 double and MatLab says that 821 index exceeds matrix dimensions)
 
Hi ,

I am a biology major grad student and I am looking a Chroma-Keying MATLAB code for removing a green background color and replacing with another image? anybody with the code please share. Thank you so much.
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 15 ·
Replies
15
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
5K
  • · Replies 7 ·
Replies
7
Views
4K