Answered

How to find the "true" perimeter of objects in a binary image?

One possible way is like this: % Example binary image with 3 non-zero pixels img = false(5); % Use zeros(5) if you pref...

How to find the "true" perimeter of objects in a binary image?

One possible way is like this: % Example binary image with 3 non-zero pixels img = false(5); % Use zeros(5) if you pref...

5 years ago | 0

| accepted

Answered

Please help me to convert opencv matrix multiplication into matlab

Your code is fine, it's just rounding error. Note that the differences are smaller, by many orders of magnitude, than the larges...

Please help me to convert opencv matrix multiplication into matlab

Your code is fine, it's just rounding error. Note that the differences are smaller, by many orders of magnitude, than the larges...

5 years ago | 0

| accepted

Answered

Matrix Dimensions Must Agree Error, Error using +

It's necessary to put spaces in the expression for |f| so that |+| and |-| are interpreted as binary operators rather than unary...

Matrix Dimensions Must Agree Error, Error using +

It's necessary to put spaces in the expression for |f| so that |+| and |-| are interpreted as binary operators rather than unary...

5 years ago | 0

Submitted

Sinkhorn-Knopp algorithm for matrix normalisation

Normalises a matrix so that the row and column sums are all unity

5 years ago | 4 downloads |

Answered

subscripted assignment dimension mismatch

You do not say how |rowspan| and |colspan| are calculated, but the problem is that they do not match the size of |R1| (or the ot...

subscripted assignment dimension mismatch

You do not say how |rowspan| and |colspan| are calculated, but the problem is that they do not match the size of |R1| (or the ot...

5 years ago | 0

Answered

Adding constant if the pixel intensity is greater than 50?

Assuming your image is stored in a variable called |img|: highValues = img > 50; img(highValues) = img(highValues) + 200...

Adding constant if the pixel intensity is greater than 50?

Assuming your image is stored in a variable called |img|: highValues = img > 50; img(highValues) = img(highValues) + 200...

5 years ago | 0

| accepted

Answered

How do I get a median filtered image?

If you have the Image Processing Toolbox, you can use <http://uk.mathworks.com/help/images/ref/medfilt2.html medfilt2>.

How do I get a median filtered image?

If you have the Image Processing Toolbox, you can use <http://uk.mathworks.com/help/images/ref/medfilt2.html medfilt2>.

5 years ago | 1

Answered

which one is faster? defining a variable as a global variable or as an input of function?

It is usually a bad idea to use global variables. There are many papers, going back over 40 years or more, explaining why. One e...

which one is faster? defining a variable as a global variable or as an input of function?

It is usually a bad idea to use global variables. There are many papers, going back over 40 years or more, explaining why. One e...

5 years ago | 2

Answered

Creating discrete variables within a for loop

I'm not quite sure what you want to do, but it feels like <http://uk.mathworks.com/help/matlab/cell-arrays.html cell arrays> mig...

Creating discrete variables within a for loop

I'm not quite sure what you want to do, but it feels like <http://uk.mathworks.com/help/matlab/cell-arrays.html cell arrays> mig...

5 years ago | 0

Answered

How to run mex files in MATLAB?

I've found <http://uk.mathworks.com/help/matlab/matlab_external/introducing-mex-files.html this documentation> to be very helpfu...

How to run mex files in MATLAB?

I've found <http://uk.mathworks.com/help/matlab/matlab_external/introducing-mex-files.html this documentation> to be very helpfu...

5 years ago | 0

Answered

rounding problem after decimal point in image processing

If you convert to class uint8 you lose everything after the decimal point. Is that perhaps the problem? If so, don't cast to uin...

rounding problem after decimal point in image processing

If you convert to class uint8 you lose everything after the decimal point. Is that perhaps the problem? If so, don't cast to uin...

5 years ago | 0

Answered

How to extract 24 binary images from one RGB image which is of 24-bit/pixel color depth?

Try this: % example rgb 24-bit image img = imread('peppers.png'); % Make the binary array array corresponding to ea...

How to extract 24 binary images from one RGB image which is of 24-bit/pixel color depth?

Try this: % example rgb 24-bit image img = imread('peppers.png'); % Make the binary array array corresponding to ea...

5 years ago | 0

Answered

Why does translation with imwarp + affine2d-object enlarges the object?

The reason for the enlargement is the interpolation rule that |imwarp| uses - 'linear' by default. Because the image is binary, ...

Why does translation with imwarp + affine2d-object enlarges the object?

The reason for the enlargement is the interpolation rule that |imwarp| uses - 'linear' by default. Because the image is binary, ...

5 years ago | 0

| accepted

Answered

Ignoring empty arrays when using arrayfun on a structure?

Try this (not yet tested): west_east = arrayfun(@(d) ~isempty(d.TTA) && 110 >= d.TTA(1) && d.TTA(1) >= 70, data); data =...

Ignoring empty arrays when using arrayfun on a structure?

Try this (not yet tested): west_east = arrayfun(@(d) ~isempty(d.TTA) && 110 >= d.TTA(1) && d.TTA(1) >= 70, data); data =...

5 years ago | 0

| accepted

Answered

How the following code works in image denoising?

To understand this properly, I think you may need to consult the author of the <http://www.mathworks.com/matlabcentral/fileexcha...

How the following code works in image denoising?

To understand this properly, I think you may need to consult the author of the <http://www.mathworks.com/matlabcentral/fileexcha...

5 years ago | 0

| accepted

Answered

How can I convert back correctly a 2D matrix to 3D one?

First, the resulting array *will* be the same as the original. Here's a demonstration (making the arrays rather smaller to avoid...

How can I convert back correctly a 2D matrix to 3D one?

First, the resulting array *will* be the same as the original. Here's a demonstration (making the arrays rather smaller to avoid...

5 years ago | 0

Answered

Saving structures from each iteration into a structure? Good idea? How?

Not sure what you've tried already and had problems with, but I'd have thought it was as simple as putting the results into stru...

Saving structures from each iteration into a structure? Good idea? How?

Not sure what you've tried already and had problems with, but I'd have thought it was as simple as putting the results into stru...

5 years ago | 0

Answered

How to compare the intensity of the central pixel with its 8 neighboring pixel in an image? Can anyone help me with its matlab code? Also I have to save my central pixel if its intensity value is greater than other pixels.

Some of the answers <http://uk.mathworks.com/matlabcentral/newsreader/view_thread/266606 here> should help.

How to compare the intensity of the central pixel with its 8 neighboring pixel in an image? Can anyone help me with its matlab code? Also I have to save my central pixel if its intensity value is greater than other pixels.

Some of the answers <http://uk.mathworks.com/matlabcentral/newsreader/view_thread/266606 here> should help.

5 years ago | 0

| accepted

Answered

Gaussian and Laplacian Random Variables

You can generate random values from a Gaussian distribution with the |randn| function. This <https://en.wikipedia.org/wiki/Lapla...

Gaussian and Laplacian Random Variables

You can generate random values from a Gaussian distribution with the |randn| function. This <https://en.wikipedia.org/wiki/Lapla...

5 years ago | 0

Answered

How to use a while loop with irregular step?

You can do it with a |for| loop very simply: for i = [1,2,3, 5,7,9, 12,15,18] % < process using i > end By the w...

How to use a while loop with irregular step?

You can do it with a |for| loop very simply: for i = [1,2,3, 5,7,9, 12,15,18] % < process using i > end By the w...

5 years ago | 0

Answered

Perform conv2 on a batch of images

|convn| does exactly what you describe, given a 3-D array and a 2-D kernel.

Perform conv2 on a batch of images

|convn| does exactly what you describe, given a 3-D array and a 2-D kernel.

5 years ago | 1

| accepted

Answered

Is it possible to create a histogram with fractional entries for each bin?

If all the samples are positive integers, and the bins are all centred on the positive integers and with unit width, as in the i...

Is it possible to create a histogram with fractional entries for each bin?

If all the samples are positive integers, and the bins are all centred on the positive integers and with unit width, as in the i...

5 years ago | 0

| accepted

Answered

Can anybody help with persistant errors? (Matlab beginer)

The assignment to |wPtr| in the first line of the function has been commented out. This means that no value has been given to th...

Can anybody help with persistant errors? (Matlab beginer)

The assignment to |wPtr| in the first line of the function has been commented out. This means that no value has been given to th...

5 years ago | 0

| accepted

Answered

How to interpolate and leave NaNs if long gaps?

I'd adopt a slightly different approach. I'd quantize the times first to get an array of just the times you want, then interpola...

How to interpolate and leave NaNs if long gaps?

I'd adopt a slightly different approach. I'd quantize the times first to get an array of just the times you want, then interpola...

5 years ago | 2

| accepted

Answered

Can a function which works well for grayscale images be applied for RGB images also?

In general, yes. You can either apply it to each of the R, G and B planes in turn, and then recombine the results, or you may be...

Can a function which works well for grayscale images be applied for RGB images also?

In general, yes. You can either apply it to each of the R, G and B planes in turn, and then recombine the results, or you may be...

5 years ago | 0

Answered

Question about the image resampling

It's just, I think, because we are told near the start of the article: _An important factor is that the sampling intervals ar...

Question about the image resampling

It's just, I think, because we are told near the start of the article: _An important factor is that the sampling intervals ar...

5 years ago | 0

| accepted

Answered

Gray(scale) image with a colormap - how to turn into double?

This works OK: [imInd, cmap] = imread('10.bmp'); imGrayUint8 = ind2gray(imInd, cmap); imGrayDouble = im2double(imGray...

Gray(scale) image with a colormap - how to turn into double?

This works OK: [imInd, cmap] = imread('10.bmp'); imGrayUint8 = ind2gray(imInd, cmap); imGrayDouble = im2double(imGray...

5 years ago | 0

| accepted

Answered

accessing indexed values in a 3D array

[rows, cols] = ndgrid(1:size(Z,1), 1:size(Z,2)); Zindex = sub2ind(size(Z), rows, cols, ind); s = Z(Zindex);

accessing indexed values in a 3D array

[rows, cols] = ndgrid(1:size(Z,1), 1:size(Z,2)); Zindex = sub2ind(size(Z), rows, cols, ind); s = Z(Zindex);

5 years ago | 2

| accepted

Answered

How can I use 'impixelinfo' function?

Perhaps you don't have the Image Processing Toolbox (IPT), or perhaps you have a very old version (before R14). Give the command...

How can I use 'impixelinfo' function?

Perhaps you don't have the Image Processing Toolbox (IPT), or perhaps you have a very old version (before R14). Give the command...

5 years ago | 0

Answered

How can I assign a value to a variable in the first iteration of a loop and for the rest of iterations the variable's value should be the outcome of the script?

Make y an argument to your function, and also remove unnecessary code: function y = fcn(v, u, y) y = y+(u-v); end ...

How can I assign a value to a variable in the first iteration of a loop and for the rest of iterations the variable's value should be the outcome of the script?

Make y an argument to your function, and also remove unnecessary code: function y = fcn(v, u, y) y = y+(u-v); end ...

5 years ago | 1