help-octave
[Top][All Lists]
Advanced

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

Re: New to Octave


From: Markus Mützel
Subject: Re: New to Octave
Date: Sun, 24 May 2020 13:26:00 +0200

Am 24. Mai 2020 um 13:19 Uhr schrieb "Primictus":
> I started using Octave yesterday as I saw a blog post  here
> <https://jasmcole.com/2014/11/01/stereographic-lampshades/>   in which
> someone uses inverse stereographic projection in MatLab to create a 3d mesh
> that can be solidified in blender and 3d printed.
>
> However, I am struggling to figure out how to convert the code to work in
> Octave.
>
> *P = imread (pattern3-e1414855483861.png)
> P = 1 - im2bw(P); % Cut Black parts
> Nmin = min(size(P));
> % Crop into square, then circle
> P = P(1:Nmin, 1:Nmin);
> [xg, yg] = meshgrid(1:Nmin, 1:Nmin);
> P((xg - Nmin/2).^2 + (yg - Nmin/2).^2 &gt; 0.99*0.25*Nmin^2) = 0;
> % Create a small border
> P = padarray(P, [1 1], 0);
>
> CC = bwconncomp(P);
>
>  for n = 1:CC.NumObjects
> % Create new image for each hole
> newP = zeros(size(P));
> newP(CC.PixelIdxList{1,n}(:)) = 1;
> % Smooth image slightly
> newP = filter2(fspecial('average',3),newP);
> % Get contour around hole
> C = contourc(newP,[1 1]);
> end*
>
> I am getting a syntax error near line 7

I'm not sure if this happened when you copied to this message or already when 
you copied the code to your .m file:
That line contains "&gt;" which is not valid Octave syntax. That should 
probably be ">".

HTH,
Markus



reply via email to

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