Re: [Scilab-users] Put an image as the background of an axis
On 09.02.2016 20:27, Samuel Gougeon wrote: You may use the z coordinate of your flat curves to manage overlays, as in: clf x = linspace(0,20,200); plot(x,sin(x)) e = gce(); c = e.children; // Example with a local image. The image is from https://atoms.scilab.org/atoms.png //xstring(0,-1,"$\scalebox{1}{\includegraphics{atoms.png}}$") // Example with a remote image under http:// (http*s*: not accepted) xstring(0,-1,"$\scalebox{1}{\includegraphics{http://www.cnrs.fr/fr/z-tools/newune/themes/CNRSTheme/images/logocnrs.png}}$";) c.data(:,3) = 0.1; // <<< HERE c.thickness = 2;You may then tune the scalebox factor. Actually, like with an uicontrol(style="image"), the imported image is inlaid and is not resized accordingly with the embedding graphical figure. HTH Samuel Gougeon Samuel Thank you for sharing these very good methods. It opens a lot of new possibilities. The way I want to use images in figure I find it better to modify your script with newaxis() before plotting. This makes the picture stay while zooming for instance: clf xstring(0,0,"$\scalebox{.3}{\includegraphics{http://photos.marinetraffic.com/ais/showphoto.aspx?photoid=445734}}$";); g=get("current_figure"); g.figure_size=[345,575]; b=newaxes(); b.filled = "off"; x = linspace(0,20,200); plot(x,sin(x)) By the way it would have been interesting to see an example with uicontrol(style="image") that you mention. I could never get that right. Brgds Jan Å ___ users mailing list users@lists.scilab.org http://lists.scilab.org/mailman/listinfo/users
Re: [Scilab-users] Put an image as the background of an axis
Hello, Without images, this post should pass the moderation ;)[to the moderator: did you decrease the max size of body recently? It was formerly possible to post with images and body> 100kB] Le 08/02/2016 11:47, antoine.monmayr...@laas.fr a écrit : Hi everyone, I just failed at placing an image behind a plot. I thought that would be easy: - create a figure - create an image uicontrol - create an axis - plot in the axis - set axis.filled="off" Apparently I was wrong. I did not find a way to overlap a plot with transparent background over my image. It seems that the image is always above the plot no matter what order the uicontrol/axes where created. I also tried to put both of them inside the same frame, but I did not work either. You may use the z coordinate of your flat curves to manage overlays, as in: clf x = linspace(0,20,200); plot(x,sin(x)) e = gce(); c = e.children; // Example with a local image. The image is from https://atoms.scilab.org/atoms.png //xstring(0,-1,"$\scalebox{1}{\includegraphics{atoms.png}}$") // Example with a remote image under http:// (http*s*: not accepted) xstring(0,-1,"$\scalebox{1}{\includegraphics{http://www.cnrs.fr/fr/z-tools/newune/themes/CNRSTheme/images/logocnrs.png}}$";) c.data(:,3) = 0.1; // <<< HERE c.thickness = 2;You may then tune the scalebox factor. Actually, like with an uicontrol(style="image"), the imported image is inlaid and is not resized accordingly with the embedding graphical figure. HTH Samuel Gougeon ___ users mailing list users@lists.scilab.org http://lists.scilab.org/mailman/listinfo/users
Re: [Scilab-users] ?= ?==?utf-8?q? Put an image as the background of an axi
Just a side question to Antoine: What do you mean with uicontrol "image". Do you speak about creating an uicontrol of type "image" and try to put an image into that uicontrol? I tried this a couple of times, but didn't manage how to do that. Never worked. But I always thought this is a bug from the uicontrol and not from IPD or SIVP. Best regards, Philipp 2016-02-09 13:36 GMT+01:00 Antoine Monmayrant : > > Le Mardi 9 Février 2016 10:26 CET, Jan Åge Langeland a > écrit: > > > > > > > On 09.02.2016 09:09, Antoine Monmayrant wrote: > > > > > > Le Mardi 9 Février 2016 08:34 CET, Philipp Mühlmann < > p.muehlm...@gmail.com> a écrit: > > > > > >> Well, the base function behind "ShowImage" is "Matplot". > > > I don't get what you mean. > > > --- > > > 2nd: it might become tricky if you want to have negative values on the > axis. > > > Probably there is a way to shift the image to other position within the > > > coordinate system? > > > > > If you look at the source code for ShowImage you should be able to > > figure out how to plot an image with matplot(). However the tricky part > > may be to get the image imported into Scilab without IPD. This is done > > in c++ with ReadImageFile.cpp. > > https://atoms.scilab.org/toolboxes/IPD/8.3.2/files/IPD-8.3.2-1-src.zip > > > > If you manage to get an image into a graphical window, the purpose of > > newaxes() is to make the XY range of the plot independent of the pixel > > ranges. > > > Ah, OK, I get your point now: if I can convert my image into scilab data, > I can plot this data and overlap an axis ontop. > Of course, you are right. > I was trying to use the uicontrol "image" to avoid the hassle of > conversion and directly use the image, well as an image! > You are right, I can convert my image into ppm, load my ppm image into > scilab as rgb hypermatrix and use Matplot + overlapped plots to get a > backgournd. > > Thanks, > > Antoine > > > > > Jan Å > > ___ > > users mailing list > > users@lists.scilab.org > > http://lists.scilab.org/mailman/listinfo/users > > > > > > > > > ___ > users mailing list > users@lists.scilab.org > http://lists.scilab.org/mailman/listinfo/users > -- There we have the salad. ___ users mailing list users@lists.scilab.org http://lists.scilab.org/mailman/listinfo/users
Re: [Scilab-users] ?==?utf-8?q? ?==?utf-8?q? ?= Put an image as the background of an axi
Le Mardi 9 Février 2016 10:26 CET, Jan Åge Langeland a écrit: > > > On 09.02.2016 09:09, Antoine Monmayrant wrote: > > > > Le Mardi 9 Février 2016 08:34 CET, Philipp Mühlmann > > a écrit: > > > >> Well, the base function behind "ShowImage" is "Matplot". > > I don't get what you mean. > > --- > > 2nd: it might become tricky if you want to have negative values on the axis. > > Probably there is a way to shift the image to other position within the > > coordinate system? > > > If you look at the source code for ShowImage you should be able to > figure out how to plot an image with matplot(). However the tricky part > may be to get the image imported into Scilab without IPD. This is done > in c++ with ReadImageFile.cpp. > https://atoms.scilab.org/toolboxes/IPD/8.3.2/files/IPD-8.3.2-1-src.zip > > If you manage to get an image into a graphical window, the purpose of > newaxes() is to make the XY range of the plot independent of the pixel > ranges. Ah, OK, I get your point now: if I can convert my image into scilab data, I can plot this data and overlap an axis ontop. Of course, you are right. I was trying to use the uicontrol "image" to avoid the hassle of conversion and directly use the image, well as an image! You are right, I can convert my image into ppm, load my ppm image into scilab as rgb hypermatrix and use Matplot + overlapped plots to get a backgournd. Thanks, Antoine > > Jan Å > ___ > users mailing list > users@lists.scilab.org > http://lists.scilab.org/mailman/listinfo/users > ___ users mailing list users@lists.scilab.org http://lists.scilab.org/mailman/listinfo/users
Re: [Scilab-users] Hilbert transform query
X = hilbert(data) computes the hilbert transform of data(:) not a N dimensionnal Hilbert transform. Please find attached a function which is intended to compute the N dimensionnal Hilbert transform obtained applying the 1D hilbert transform to all columns then to all rows, This function exploits the ability of fft to compute all fft along a given dimension with a single call. Serge Le 08/02/2016 17:51, Lester Anderson a écrit : So what would the syntax be for doing a column run Hilbert, and row run Hilbert? It does sound like the suggesting would do what I think it is meant to. X = hilbert(data) // does compute pretty fast! At the moment I have used the netCDF code to read in GMT (net CDF) data, which is a 601 x 601 matrix (x,y). So in order to do the column and row method is it necessary to transpose the matrix, e.g. x = x' ? Thanks for any pointers On 5 February 2016 at 19:02, Tim Wescott wrote: Any time you go from 1D to 2D you suddenly end up with more than one way to do things, so I'm pretty sure that "how would one..." should really be worded "how would YOU...", or perhaps "how would someone in this field...". It sounds like you want to keep things rectilinear, so it may be best to just apply the transform column-by-column and row-by-row. That SHOULD work, and if you do it as matrix operations it should be pretty fast in Scilab. On Fri, 2016-02-05 at 12:52 +, Lester Anderson wrote: Hi Serge, I am working with grid data, so looking for the 2D Hilbert, the results I think should appear similar to doing a directional derivative, where X highlights features with N-S trends and E-W for Y. Lester On 5 February 2016 at 12:24, Serge Steer wrote: Le 05/02/2016 10:56, Lester Anderson a écrit : Hello A quick query. How would one define the Hilbert transform of a grid for X and Y directions; looking for two solutions Hx and Hy (for the real values). Can you explain more precisely what you expect? Do you want to apply Hilbert transform to each column and to each rows or to perform a 2D Hilbert transform? Serge Thanks Lester ___ users mailing list users@lists.scilab.org http://lists.scilab.org/mailman/listinfo/users ___ users mailing list users@lists.scilab.org http://lists.scilab.org/mailman/listinfo/users ___ users mailing list users@lists.scilab.org http://lists.scilab.org/mailman/listinfo/users -- Tim Wescott www.wescottdesign.com Control & Communications systems, circuit & software design. Phone: 503.631.7815 Cell: 503.349.8432 ___ users mailing list users@lists.scilab.org http://lists.scilab.org/mailman/listinfo/users ___ users mailing list users@lists.scilab.org http://lists.scilab.org/mailman/listinfo/users function x = hilbertND(x) // Marple, S.L., "Computing the discrete-time analytic signal via FFT," // IEEE Transactions on Signal Processing, Vol. 47, No.9 (September // 1999), pp.2600-2603 // http://ieeexplore.ieee.org/iel5/78/16975/0078.pdf?arnumber=78 if type(x)<>1 then error(msprintf(gettext("%s: Wrong type for input argument #%d: Array of floating point numbers expected.\n"),"hilbert",1)) end if x==[] then return;end if ~isreal(x,0) then error(msprintf(gettext("%s: Input argument #%d must be real.\n"),"hilbert",1)); end d=size(x); for k=1:size(d,'*') n=d(k) if k<>1 then x=permute(x,[k,1]); end dp=size(x) x=matrix(x,d(k),-1) x = fft(real(x),-1,1); h=zeros(x) no2 = int(n/2); if ((2*no2) == n) then // n is even h([1,no2+1],:) = 1; h(2:no2,:) = 2; else // n is odd h(1,:) = 1; h(2:(n+1)/2,:) = 2; end x = fft(x.*h,1,1); x=matrix(x,dp) if k<>1 then x=permute(x,[k,1]);end end endfunction ___ users mailing list users@lists.scilab.org http://lists.scilab.org/mailman/listinfo/users
Re: [Scilab-users] ?= Put an image as the background of an axi
On 09.02.2016 09:09, Antoine Monmayrant wrote: Le Mardi 9 Février 2016 08:34 CET, Philipp Mühlmann a écrit: Well, the base function behind "ShowImage" is "Matplot". I don't get what you mean. --- 2nd: it might become tricky if you want to have negative values on the axis. Probably there is a way to shift the image to other position within the coordinate system? If you look at the source code for ShowImage you should be able to figure out how to plot an image with matplot(). However the tricky part may be to get the image imported into Scilab without IPD. This is done in c++ with ReadImageFile.cpp. https://atoms.scilab.org/toolboxes/IPD/8.3.2/files/IPD-8.3.2-1-src.zip If you manage to get an image into a graphical window, the purpose of newaxes() is to make the XY range of the plot independent of the pixel ranges. Jan Å ___ users mailing list users@lists.scilab.org http://lists.scilab.org/mailman/listinfo/users
Re: [Scilab-users] Xcos: Error when running a compiled superblock
Hello Clément, Thank you for the tip. Indeed running the "loader.sce" and the "*.sci" file allowed me to reuse the model later.I will definitively look at the toolbox thing too, as I want to distribute my model to other people. Regards,Benoit Le Mardi 26 janvier 2016 11h01, Clément David a écrit : Hello Benoit, During code generation, scilab will generate both the C file of the superblock and the equivalent block interface function (a scilab macro). To re-use it later, you have to link the library (to load the simulation function) and the execute the interface function file (to load the block). To generalize your approach I strongly suggest you to ship both the Xcos schema and the C, macro files as an external module (aka toolbox). This way you will only need to build the block once on your side and distribute the module to your users. Regards, -- Clément Le vendredi 22 janvier 2016 à 03:26 -0700, ENd48 a écrit : > Good morning, > > I'm trying to compile a superblock but I've got problem running the > simulation afterwards. > Here is what I do: > * I create a very simple diagram (constant value fed into the two ports of > a sum block then a AFFICH_m block with an event clock) > * I convert the sum block into a superblock > * At this stage the diagram works just well > * I then compile the superblock (right click -> compile) > * The compilation works and the diagram is still working > * Now if I close Scilab and reopen it, I run the "loader.sce" file that has > been generated during the compilation (I get a "Link done" message) > * If I try to run the diagram, I got an error message like this one: > o=Untitled__111506_c('set',o) > !--error 4 > Undefined variable: Untitled__111506_c > > > do_eval: Error while calling block Untitled__111506_c > [uid='-16a0de62:15268d37 > 216:-7fb8']: invalid parameter (ier=4.00, > %scicos_prob=%F). > > Does anybody know about such an error? What could be the solution to this > problem? > > Thanks in advance for your help. > > Regards, > Benoit > > > > -- > View this message in context: > http://mailinglists.scilab.org/Xcos-Error-when-running-a-compiled-su > perblock-tp4033315.html > Sent from the Scilab users - Mailing Lists Archives mailing list archive at > Nabble.com. > ___ > users mailing list > users@lists.scilab.org > http://lists.scilab.org/mailman/listinfo/users ___ users mailing list users@lists.scilab.org http://lists.scilab.org/mailman/listinfo/users ___ users mailing list users@lists.scilab.org http://lists.scilab.org/mailman/listinfo/users
Re: [Scilab-users] ?==?utf-8?q? ?==?utf-8?q? ?= Put an image as the background of an axi
Le Mardi 9 Février 2016 08:34 CET, Philipp Mühlmann a écrit: > Well, the base function behind "ShowImage" is "Matplot". I don't get what you mean. My point is the following: "ShowImage" is not defined in the scilab base install. You have to install an atom module to get access to it, in this case, it's IPD. Saddly, IPD is broken for both the fedora and ubuntu linux distributions we use at work so I cannot use it. IPD fails at detecting the installed opencv library installed. I tried to patch "IPD.start" to load the installed opencv libs, but it crashes scilab. Antoine > > You can use a search engine of your choice to find ShowImage.sci. > > "ShowColorImage" than is using "ShowImage" to create a colored Image. > > Hope that helps, > > Philipp > > > > > 2016-02-09 8:04 GMT+01:00 Antoine Monmayrant : > > > > > Le Mardi 9 Février 2016 00:04 CET, Philipp Mühlmann > > a écrit: > > > > > Well, as I understand you want to plot a function over an background > > image. > > > > > > In the case the image pixel number fits the X-Y range of your graph it's > > > rather simple. > > > > Well, it is, unless IPD does not work on your system, which is my case! > > None, absolutely none of the image processing toolboxes work on my machine. > > And it's not only my machine, it's the case for most of the machines we > > have at work. > > So I cannot rely on an image processing toolbox to achieve what I want and > > I have to rely on base functions. > > > > Thanks anyway for you help, > > > > Antoine > > > > > > > > img = ReadImage(IPD_PATH + 'demos\teaset.png'); > > > rows = size(img,'r');cols = size(img,'c'); > > > img(rows,1,:) = (0);// changing left lower image corner for > > > checking purpose > > > // change all 3 colour > > > channels to get a black pixel > > > ShowColorImage(img,''); > > > a = gca();a.axes_visible = ["on","on","off"];x = linspace(1,600,600);y > > > = 1/2*(x);plot(x,y,'-');a.data_bounds = [0,0;cols,rows]; > > > > > > Two tricky things though: > > > > > > 1st: image coordinates (center of pixel) start at "1", hence there is a > > gap > > > of 0.5 between image borders and the axes > > > > > > 2nd: it might become tricky if you want to have negative values on the > > axis. > > > > > > Probably there is a way to shift the image to other position within the > > > coordinate system? > > > > > > > > > Sonot sure if this helps your purpose. > > > > > > You could also switch "ON" / "OFF" the background image by access the > > > children of the figure, such as: > > > > > > IMGPlot = a.Children(2); // children(2) is the background in this > > > caseIMGPlot.visible = 'off'; > > > > > > > > > A complete other way would be to combine two images of same size. > > > Say...background image is img1. > > > > > > your plot = img2. > > > Plot the graph and save the figure as a temporary image. > > > > > > load img1 > > > load temporary image > > > > > > If size (img1) == size(img2)You could use SIVP module to linear > > combine > > > two images: > > > > > > img_gray = double(RGB2Gray(img));img2 = zeros(rows, cols) + > > > 255;img2(rows/2,:) = 0;img3 = imlincomb( 0.5, img_gray, 0.4, img2) > > > // the values here define some kind of transparency.figure(); > > > ShowImage(img3,''); > > > > > > > > > > > > Best regards, > > > Philipp > > > > > > > > > > > > > > > 2016-02-08 17:49 GMT+01:00 Jan Åge Langeland : > > > > > > > > > > > > > > > On 08.02.2016 11:47, antoine.monmayr...@laas.fr wrote: > > > > > > > > Hi everyone, > > > > > > > > I just failed at placing an image behind a plot. > > > > I thought that would be easy: > > > > - create a figure > > > > - create an image uicontrol > > > > - create an axis > > > > - plot in the axis > > > > - set axis.filled="off" > > > > > > > > Apparently I was wrong. > > > > I did not find a way to overlap a plot with transparent background > > over my > > > > image. > > > > It seems that the image is always above the plot no matter what order > > the > > > > uicontrol/axes where created. > > > > I also tried to put both of them inside the same frame, but I did not > > work > > > > either. > > > > > > > > Any idea? > > > > > > > > > > > > > > > > ShowImage(im,'J2'); > > > > > > > > b=newaxes(); > > > > b.filled = "off"; > > > > plot(a) > > > > > > > > JÅ > > > > > > > > ___ > > > > users mailing list > > > > users@lists.scilab.org > > > > http://lists.scilab.org/mailman/listinfo/users > > > > > > > > > > > > > > > > ___ > > > > users mailing list > > > > users@lists.scilab.org > > > > http://lists.scilab.org/mailman/listinfo/users > > > > > > > > > > > > > > > > > -- > > > There we have the salad. > > > > > > > > > > > > > > ___ > > users mailing list > > users@lists.scilab.org > > http://lists.scilab.org/mailman/listinfo/users > > > > > > -- > There we hav