[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Deleting multiple Values in an 2D-Array

From: Jordi Gutiérrez Hermoso
Subject: Re: Deleting multiple Values in an 2D-Array
Date: Sun, 30 Dec 2012 10:52:03 -0500

On 30 December 2012 09:51, Nikolai Huckle <address@hidden> wrote:
> The first step I did(which im not sure is needed), was to delete all
> the multiple occuring value pairs, but this already has proven to be
> difficult as I cant vectorize the code which i used.

Deleting multiple points is easy:

    minAJ = randi (50,2000,1);
    minEJ = randi (50,2000,1);
    Tuple1 = unique ([minAJ, minEJ], "rows");

As to your actual problem...

> The issue I have is, that I only want the outline of the point
> cloud: the farthest points to the right, the left and upwards.

This considerably more tricky. I think your best option, if the point
cloud is actually pixels in a binary image, to use bwborder from the
image package. Here is one way to do it, and you don't need to remove
doubled-up points:

    idx = sub2ind ([50, 50], minAJ, minEJ);
    bw = zeros (50,50);
    bw(idx) = 1;
    imshow (bwborder (bw))

Sadly, bwborder only considers 4-connectivity, i.e. diagonal pixels
are not adjacent. If you need finer control than that, you can use

- Jordi G. H.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]