Using scilab for the first time and I do not know how to fix it. I want to convert RGB image to grayscale. What to do?
The imread() function doesn't exist natively in Scilab (are you trying to port a Matlab code?). It does exist, however, as part of the SIP (Scilab Image Processing) toolbox which can be downloaded and installed using ATOMS (Scilab's Toolbox Manager). You can find ATOMS under the "Applications>ATOMS" menu in the Scilab console.
SIP also comes with the im2gray() function which essentially does what you want. After having installed and loaded SIP in Atoms, try:
// import RGB jpeg pic
RGBpic = imread("rgb.jpg");
// convert to grayscale
GSpic = im2gray(RGBpic);
// create new figure window and display grayscale pic
scf(0);clf();
imshow(GSpic);
Related
I use R and the Magick package to process screenshots! Currently, I'm going through an external tool to get my screenshots. This tool gives me a file (png or other) that I have to reload to use it with Magick. Is there a package that would allow me to take screenshots (in whole or only partially) and to retrieve the image directly into a variable without going through an intermediate file? I found plenty of stuff for web-snapshots but nothing for a capture of my screen...
Thanks in advance
Is it possible using Octave in Jupyter Notebook to open plots in an external window so that they can be manipulated (zooming in/out, rotating)?
I hoped there would be some switch so that I could use them inline (as it is by default) but if need be, I could open them in an external window to manipulate it the way like in GNU Octave GUI. After checking what I need, I would switch back to inline.
I looked for some hints. I found this %%octave -g in octavemagic: Octave inside IPython. Unforutunately, it doesn't work for me when using Octave kernel.
I found something about inline plotting in An Octave kernel for Jupyter (Configuration section) but it doesn't look like it could help anything in regard to switching on/off it from the notebook.
For example, I would like the following code to invoke an external window.
y=-10:0.4:10+eps;
[xx,yy]=meshgrid(x,y);
zz= sin(sqrt(xx.^2+yy.^2))./(sqrt(xx.^2+yy.^2));
surf(xx,yy,zz)
view(-35,45)
It looks like that I have finally found the answer here:
https://github.com/Calysto/octave_kernel/issues/98
https://github.com/Calysto/octave_kernel/issues/6
https://am111.readthedocs.io/en/latest/jmatlab_use.html
%plot gnuplot - switch to using external window
%plot inline - switch to using inline plotting
I'm trying to use octave to draw root locuses and apparently the code for drawing it was written in the early 2000s so everything is far too small to see. I can't figure out how to modify everything to be at a visible size, and I shouldn't have to.
How do I configure gnuplot to make everything be a visible size by default? I can't find any info on how to configure it with google.
Edit:
Here's the code:
pkg load control;
s = tf('s');
rlocus((s+10)/(s*(s+1)*(s+20)))
That produces a plot that looks like this:
Thank you for the code. This may not be a full answer for you, but I'm writing this in the form of an answer in order to post images...
Your graph looks a bit weird indeed for a default graph. This is what your code produces on my system (Linux Mint, Octave v6.2.0) by default (i.e. using the qt toolkit):
It would be helpful to have some more information:
What operating system are you using?
What version of octave are you using?
What graphics toolkit are you using? (type graphics_toolkit in the octave console), and if this is not the default qt one, why is this the case?
Having said that, if you're happy to specify some graph settings yourself, it is certainly possible to specify fontsizes etc. E.g.
pkg load control;
s = tf('s');
rlocus((s+10)/(s*(s+1)*(s+20)))
set( gca, 'fontsize', 20 )
Pos = get( gcf, 'position' ); set( gcf, 'position', Pos + [0, 0, 500, 200] )
i want to display images in Jupyter using Image.jl.
the doc says:
If you're using the IJulia notebook, images will be displayed automatically.
Julia code for the display of images can be found in ImageView. Installation of this package is recommended but not required.
but i failed to find any way to automatically display images in a for loop. the code below is an example:
using Images
for i=1:10
convert(Image,rand(100,100))
end
i guess there exits an undocumented function to draw images in IJulia which can be called explicitly to show out those hidden results. thanks in advance! #tholy
You need to use the display function, which is what IJulia uses, you can find it's documentation in the Multimedia I/O section of the Julia manual.
I'm new here.
I've the same matter as this one but only using QtOctave; beside oct2mat pkg hasn't never been loaded on my pc.
Typing:
pkg unload oct2mat
octave returns:
error: package oct2mat is not installed
error: \share\octave\3.6.2\m\pkg\pkg.m at line 2170, column 9
Using plot function directly in Octave it works properly, very stange!
Can enybody help me?
Thanks in advance.
Addendum to #vinukn's answer, as it might be too cryptic.
Try this:
>>> graphics_toolkit
ans = fltk
>>> agts = available_graphics_toolkits
agts =
{
[1,1] = fltk
[1,2] = gnuplot
}
>>> graphics_toolkit(agts{2}) % This sets the graphics toolkit.
>>> plot([1 2 3 4])
That is, the default was FLTK, and I've set Gnuplot. Try each, they look slightly different to each other.
This is on my default installation of Octave 3.6.2 on Windows Vista, with QtOctave. (I've tried the most recent build of Octave, with built-in GUI, but after starting it never drew in its windows, so it was unusable at this stage, which is a shame as there are probably a handful of lines of code that need to be changed to make it work... Will wait until that is fixed. In the meantime, Gnuplot doesn't freeze.)
Also, here is a list of keys to use in the Gnuplot window. Especially note:
Right-click to draw a zoom box.
a to autoscale (back to default zoom).
p to go back to the most recent previous zoom.
Don't use QtOctave. It has been deprecated for a reason. See the GUI section in Octave FAQ to understand why the GUI doesn't work. It is specially true for things such as plots and dialog windows.
Take special note on the fact that QtOctave and others are specially sensitive to new versions of Octave. You are using Octave 3.6.2 while QtOctave was abandoned back in 3.2.X. Your options are (by order of what I recommend):
use Octave on its own, no QtOctave;
build from development sources to use the experimental GUI;
fix QtOctave (I actually don't recommend this one at all. Its website has been closed, and it would be too much work which would be better spent helping the Octave developers with the native GUI);
Actually,the reason behind this problem is default graphics toolkit fltk or qt. Qtoctave works with pipe, fltk does nt support pipe, ie fltk works inside octave. Pipe does nt support both text and image(gui) same time. The solution is change default toolkit to gnuplot.