How do I make text color black when using the function insertText
    5 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    fadams18
      
 el 3 de Feb. de 2020
  
    
    
    
    
    Comentada: Image Analyst
      
      
 el 4 de Feb. de 2020
            Hello I created a white image using the code below. and then i inserted a text. but the text has yellow background. I dont know where this is coming from
N=500;
M=500;
whiteImage = 255 * ones(N, M, 'uint8'); 
DD= insertText(whiteImage, [100,234],'Hello World','FontSize',18,'TextColor','black');
imshow(DD);
Please help, how do I remove the yellow background under the text

0 comentarios
Respuesta aceptada
  dpb
      
      
 el 3 de Feb. de 2020
        Read the rest of the documentation...
'BoxColor' — Text box color
 'yellow' (default) | character vector | cell array of character vectors | [R G B] vector | M-by-3 matrix
 Use
 DD= insertText(whiteImage, [100,234],'Hello World','FontSize',18,'TextColor','black','BoxColor','white');
 It seems a more logical 'Default' choice would be the existing background color of the image, but I guess that's probably more difficult to ascertain...
8 comentarios
  Image Analyst
      
      
 el 4 de Feb. de 2020
				Depends on whether you want to do a weighted average of the images, or if you want to do masking.  You're doing masking where you'll set the underlying image to pure black wherever your other image is equal to 1.  Try it and see if this is what you want.  I would probably suggest a weighted sum though, like 0.7 of one image plus 0.3 of the other image.
Más respuestas (1)
  Image Analyst
      
      
 el 3 de Feb. de 2020
        It comes from the 'BoxColor' option.  See the documentation.  To have background be white:
N=500;
M=500;
whiteImage = 255 * ones(N, M, 'uint8'); 
DD= insertText(whiteImage, [100,234],'Hello World','FontSize',18,'TextColor','black', 'BoxColor', 'white');
imshow(DD);
Ver también
Categorías
				Más información sobre Read, Write, and Modify Image en Help Center y File Exchange.
			
	Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



