Why am I getting an error when I use grayscale images with

Why am I getting an error when I use grayscale images with “makehdr”in Image Processing Toolbox 8.1 (R2012b)?

I am receiving the following error when trying to use the “makehdr” utility.

low dynamic images must be RGB

I suspect the reason is that my images are black-and-white. Is there any workaround for this issue?

NOTE:-

Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.

“makehdr” works only on RGB images. The workaround for this issue is to convert the grayscale image to an RGB image.

Grayscale images are 2D (m x n) matrices, while RGB images are 3D (m x n x 3) matrices. Therefore one must expand the 2D matrix to fill the 3D matrix. This can be accomplished a couple ways

1. Use REPMAT to replicate the 2D matrix 3 times.

% Step 1 - Load grayscale image
imGray = imread('grayscaleImage.tif');
% Step 2 - Replicate image into RGB layers using REPMAT
nRV = 1; % Number Of Replications Vertically
nRH = 1; % Number Of Replications Horizontally
nRL = 3; % Number Of Replication Layers
imRGB = repmat(imGray,[nRV, nRH, nRL]); % Replicate grayscale image 3 times
% Step 3 - Write resized image to file
imageName = 'rgbImage.tif';
imwrite(imRGB,imageName)

SEE COMPLETE ANSWER CLICK THE LINK

--

--

--

Simple! That is me, a simple person. I am passionate about knowledge and reading. That’s why I have decided to write and share a bit of my life and thoughts to.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Is Arduino that much easy for you?

How to use your Assistant to turn on your PC/Mac the right way

Flowchart

Successfully upgrade OpenShift cluster on a disconnected environment with troubleshooting guide.

operators in c with example

Part 2: GNS3 Installation on Ubuntu 20.04 (GCP)

Top Programming Languages and Web Frameworks To Learn in 2022

Chapter 7 Attorney

chapter 7 attorney

Guide to integrate Google Cloud Workflows with other Google services.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Technical Source

Technical Source

Simple! That is me, a simple person. I am passionate about knowledge and reading. That’s why I have decided to write and share a bit of my life and thoughts to.

More from Medium

I am the beginer for doing simple image subtration to obtain defect image.

Pneumonia Detection with AI in 10 minutes

The Perceptron Algorithm Simplified !

Detecting Room Occupancy Using Machine Learning and Sensor Data