Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Image 以GNU倍频程在显示图像上绘图_Image_Plot_Octave - Fatal编程技术网

Image 以GNU倍频程在显示图像上绘图

Image 以GNU倍频程在显示图像上绘图,image,plot,octave,Image,Plot,Octave,我正在开发一些八度的例程,需要显示一个图像,然后在顶部绘制一条曲线,希望它能覆盖一些图像特征 但是,我无法确定如何匹配图像和绘图的原点/比例。例如,给定1024x1024像素的图像,我可以: a=imread('image.png'); x=linspace(1,1024,100); y=x; imshow(a); hold on; plot(x,y); 但该线不会缩放到图像,也不会从角点开始。(我知道图像和情节应该在不同的角落有起源)。当我从光标位置检查图形坐标时,图像显然不在原点,因此我猜

我正在开发一些八度的例程,需要显示一个图像,然后在顶部绘制一条曲线,希望它能覆盖一些图像特征

但是,我无法确定如何匹配图像和绘图的原点/比例。例如,给定1024x1024像素的图像,我可以:

a=imread('image.png');
x=linspace(1,1024,100);
y=x;
imshow(a);
hold on;
plot(x,y);
但该线不会缩放到图像,也不会从角点开始。(我知道图像和情节应该在不同的角落有起源)。当我从光标位置检查图形坐标时,图像显然不在原点,因此我猜这是问题的基础。

在这种情况下使用
image()
而不是
imshow()

a = imread ('image.png');
x = linspace (1, 1024, 100);
y = x;
image (a);
hold on
plot (x, y);
axis square
在这种情况下,请使用
image()
而不是
imshow()

a = imread ('image.png');
x = linspace (1, 1024, 100);
y = x;
image (a);
hold on
plot (x, y);
axis square

您可以通过以下方式在图像上绘制函数:

octave> x = 0:1:5;
octave> plot(x, (3/2).^x, "linewidth", 2, "color", "blue");
octave> hold on
octave> plot(x, 2.^x, "linewidth", 2, "color", "red");
octave> plot(x, factorial(x), "linewidth", 2, "color", "green");
octave> plot(x, x.^3, "linewidth", 2, "color", "black");
octave> 
  • 像这样创建一个名为stuff.jpg的图像,任何大小都可以,但我将我的图像制作为大约6x6像素,以便测试:

  • 您可以通过以下方式在其他函数上绘制函数:

    octave> x = 0:1:5;
    octave> plot(x, (3/2).^x, "linewidth", 2, "color", "blue");
    octave> hold on
    octave> plot(x, 2.^x, "linewidth", 2, "color", "red");
    octave> plot(x, factorial(x), "linewidth", 2, "color", "green");
    octave> plot(x, x.^3, "linewidth", 2, "color", "black");
    octave> 
    
    对我来说,这表明:

    发现这里有一个演练:

    octave> x = 0:1:5;
    octave> plot(x, (3/2).^x, "linewidth", 2, "color", "blue");
    octave> hold on
    octave> plot(x, 2.^x, "linewidth", 2, "color", "red");
    octave> plot(x, factorial(x), "linewidth", 2, "color", "green");
    octave> plot(x, x.^3, "linewidth", 2, "color", "black");
    octave> 
    


    根据我的年龄绘制出我的力量等级。它已经超过九千个了。

    您可以通过以下方式在图像上绘制函数:

    octave> x = 0:1:5;
    octave> plot(x, (3/2).^x, "linewidth", 2, "color", "blue");
    octave> hold on
    octave> plot(x, 2.^x, "linewidth", 2, "color", "red");
    octave> plot(x, factorial(x), "linewidth", 2, "color", "green");
    octave> plot(x, x.^3, "linewidth", 2, "color", "black");
    octave> 
    
  • 像这样创建一个名为stuff.jpg的图像,任何大小都可以,但我将我的图像制作为大约6x6像素,以便测试:

  • 您可以通过以下方式在其他函数上绘制函数:

    octave> x = 0:1:5;
    octave> plot(x, (3/2).^x, "linewidth", 2, "color", "blue");
    octave> hold on
    octave> plot(x, 2.^x, "linewidth", 2, "color", "red");
    octave> plot(x, factorial(x), "linewidth", 2, "color", "green");
    octave> plot(x, x.^3, "linewidth", 2, "color", "black");
    octave> 
    
    对我来说,这表明:

    发现这里有一个演练:

    octave> x = 0:1:5;
    octave> plot(x, (3/2).^x, "linewidth", 2, "color", "blue");
    octave> hold on
    octave> plot(x, 2.^x, "linewidth", 2, "color", "red");
    octave> plot(x, factorial(x), "linewidth", 2, "color", "green");
    octave> plot(x, x.^3, "linewidth", 2, "color", "black");
    octave> 
    


    根据我的年龄绘制出我的力量等级。图像的问题是它把(0,0)(而不是(minux,minuy))放在左上角,而我们通常期望(0,0)放在左下角

    此外,它只使用x和y向量的最大值和最小值,所以执行y(结束:-1:1)不起作用

    im = imread('file.png'); %read the file
    image([xmin xmax],[ymin ymax],im(end:-1:1,:,:)); %put the image on the screen upside down
    axis('xy'); % flip the image by putting (0,0) at bottom left. Image now right side up
    axis('square'); if you want to aspect ratio of the image to be 1:1
    hold on;
    plot([xmin xmax],[ymin ymax]) % this should draw a diagonal from bottom left to upper right.
    % plot whatever you want to overlay
    

    图像的问题在于它将(0,0)(而不是(minux,minuy))放在左上角,而我们通常期望(0,0)放在左下角

    此外,它只使用x和y向量的最大值和最小值,所以执行y(结束:-1:1)不起作用

    im = imread('file.png'); %read the file
    image([xmin xmax],[ymin ymax],im(end:-1:1,:,:)); %put the image on the screen upside down
    axis('xy'); % flip the image by putting (0,0) at bottom left. Image now right side up
    axis('square'); if you want to aspect ratio of the image to be 1:1
    hold on;
    plot([xmin xmax],[ymin ymax]) % this should draw a diagonal from bottom left to upper right.
    % plot whatever you want to overlay
    

    非常感谢,Carandraugh——这对我来说很好。在我看来,如果a是一个二进制值矩阵,图像(a)就会失败,但转换为uint会修复它。非常感谢,Carandraugh-这对我来说是成功的。在我看来,如果a是二进制值矩阵,图像(a)就会失败,但转换为uint会修复它。