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

Sitecore Managed Cloud — How to integrate an observability platform

Automating the data movement from GCS using Data Transfer Service

How To… make your Doorbell smart

Randomizing Power Ups

Project Avaware #1: A look at what we’re working on

Hadoop Single Node Cluster on Docker

Setting up a platformer project in Unity

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

Underwater soundwave for different starting angles

5 Industries That Rely on Python for Development

ResNet50 vs ResNeXt50: an experiment with CIFAR10 data

What is the Best Way to Debug a Tensor Flow Model?