insertText function not accepting a uint8 image

3 visualizzazioni (ultimi 30 giorni)
Jacob Nazarian
Jacob Nazarian il 28 Giu 2016
Commentato: Jeff il 16 Apr 2019
if true
% code
end
%
%First I read a .png format picture and save it to the variable "importedSpecSheet"
importedSpecSheet = imread('Jakes_Drawing_Template_with_E.png');
%
%Next, I define a cell array with several strings that will be the text fields to be inserted into the image
textValues = {'Microwave Components, Inc.','Part Number','xx-xxx-xx', '________________________________________________________________________________________________________', 'Wire Gauge','Wire Diameter','Number of Turns','Inside Diameter','Dimension C','Wire Type','DC Resistance','Insulation Type','Spaced','Axial','Inductance'};
%
%Next I define an array of numeric values that will serve as the position array for all the text fields that will be inserted
%The textPositions array has the same number of rows as the textValues array has elements
textPositions = zeros(numel(textValues),2);
textPositions(1,1) = 500;
textPositions(1,2) = 775;
textPositions(2,1) = 572;
textPositions(2,2) = 800;
textPositions(3,1) = 564;
textPositions(3,2) = 825;
textPositions(4,1) = 100;
textPositions(4,2) = 835;
textPositions(5:numel(textValues),1) = 200;
for j = 1:numel(textValues)-4
textPositions(j+4,2) = (950 + 50*(j-1));
end
%
%Now I attempt to use the insertText function
specSheet = insertText(importedSpecSheet,textPositions,textValues,'FontSize',20,'TextColor','black','BoxColor','white');
I have the Image Processing Toolbox and the Computer Vision System toolbox both installed on R2016a.
This function actually worked perfectly for a few weeks, then one day I ran the script and got the following error:
"Undefined function 'insertText' for input arguments of type 'uint8'.
Error in Create_Coil_Spec_Sheet_GUI>pushbutton1_Callback (line 397)
specSheet = insertText(importedSpecSheet,textPositions,textValues,'FontSize',20,'TextColor','black','BoxColor','white');"
I used the class function to investigate:
class(importedSpecSheet) ---------> ans=char
class(imread('Jakes_Drawing_Template_with_E.png')) ---------> ans=uint8
So I explored with using:
specSheet = insertText(imread('Jakes_Drawing_Template_with_E.png'),textPositions,textValues,'FontSize',20,'TextColor','black','BoxColor','white');"
But I recieved the same error.
I'm not sure that this matters, but this script ran perfectly when I was using the free trial version, and then I bought the Student Version (R2016a) and I have not been able to shake this error since.
I'm new here but I tried to attach the image below if that is necessary:
Thanks.

Risposte (0)

Categorie

Scopri di più su Mathematics and Optimization in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by