| 查看: 5416 | 回复: 48 | |||
| 当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖 | |||
[求助]
请教如何用matlab识别出一张曲线图上最高点对应的X,Y轴坐标 已有14人参与
|
|||
|
对于一张jpg图(例如下图),没有原始的数据,对于图中曲线,如何用matlab识别出最高点对应的X,Y轴坐标呢?我有很多这样的图,所以能编出程序或写出代码自动识别就好了,然后将坐标输出,请问谁有什么想法或者谁会吗? ref.jpg |
» 猜你喜欢
回收溶剂求助
已经有7人回复
职称评审没过,求安慰
已经有40人回复
硝基苯如何除去
已经有3人回复
A期刊撤稿
已经有4人回复
垃圾破二本职称评审标准
已经有17人回复
投稿Elsevier的Neoplasia杂志,到最后选publishing options时页面空白,不能完成投稿
已经有22人回复
申请26博士
已经有5人回复
EST投稿状态问题
已经有7人回复
毕业后当辅导员了,天天各种学生超烦
已经有4人回复
求助文献
已经有3人回复
» 本主题相关价值贴推荐,对您同样有帮助:
如何在origin中画三维柱状图
已经有9人回复
这种图是怎么画的?用origin吗?
已经有4人回复
origin中怎样把三维图坐标轴上的数字变得更清晰
已经有4人回复
求一款从数据图线上描点取数据的软件
已经有6人回复
origin 如何将图形水平垂直移动
已经有9人回复
如何用Matlab曲线拟合一个多输入参数,而且其中一个输入参数与另一个参数有关呢?
已经有6人回复
怎样将多种曲线拟合后的曲线图放在同一张图上
已经有12人回复
matlab画柱形图
已经有5人回复
fluent计算的后处理:怎么把两组不同的数据画在一个曲线图里,作对比分析用
已经有14人回复
Origin 画柱形图不会,我的柱子挤一起了。 (附图,大家帮忙看看)
已经有15人回复
数据绘图问题,请教各位
已经有15人回复
请教如何改图片分辨率
已经有8人回复
求助:如何在matlab中把figure的曲线对应的data导出来xls或者txt格式
已经有8人回复
【求助】如何使得matlab拟合的曲线强制经过一个点
已经有8人回复
【答案】应助回帖
★
感谢参与,应助指数 +1
lqshn: 金币+1, ★有帮助 2015-06-16 13:16:18
感谢参与,应助指数 +1
lqshn: 金币+1, ★有帮助 2015-06-16 13:16:18
|
试试泰勒公式, 渐近线, 高数课本里学过, 可以模拟各种曲线的坐标, 或者还有其他方法, 具体的记不清了。 这其实不仅是编程,更多的是对数学建模的理解和方法的选择, 你可以找个学数学的专业人士讨论一下, 肯定会有收获。 至于图像的扫描和像素的识别, 编程方面没有什么大的难度, 每个JPG 像素都是一个数值的形式储存的, 对像素颜色数值进行分析就是了(个人想法,没试过)。windows 或c++ 或java 都有自己的类库 专门做图像分析和处理的,是一些DLL 类库, 直接拿来用就是了。一下是一个java例程,图片处理的, Below is the syntax highlighted version of Picture.java from § Standard Libraries. Here is the Javadoc. /************************************************************************* * Compilation: javac Picture.java * Execution: java Picture imagename * * Data type for manipulating individual pixels of an image. The original * image can be read from a file in jpg, gif, or png format, or the * user can create a blank image of a given size. Includes methods for * displaying the image in a window on the screen or saving to a file. * * % java Picture mandrill.jpg * * Remarks * ------- * - pixel (x, y) is column x and row y, where (0, 0) is upper left * * - see also GrayPicture.java for a grayscale version * *************************************************************************/ import java.awt.Color; import java.awt.FileDialog; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.net.URL; import javax.imageio.ImageIO; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.KeyStroke; /** * This class provides methods for manipulating individual pixels of * an image. The original image can be read from a <tt>.jpg</tt>, <tt>.gif</tt>, * or <tt>.png</tt> file or the user can create a blank image of a given size. * This class includes methods for displaying the image in a window on * the screen or saving it to a file. * <p> * Pixel (<em>x</em>, <em>y</em> is column <em>x</em> and row <em>y</em>.* By default, the origin (0, 0) is upper left, which is a common convention * in image processing. * The method <tt>setOriginLowerLeft()</tt> change the origin to the lower left. * <p> * For additional documentation, see * <a href="http://introcs.cs.princeton.edu/31datatype">Section 3.1</a> of * <i>Introduction to Programming in Java: An Interdisciplinary Approach</i> * by Robert Sedgewick and Kevin Wayne. * * @author Robert Sedgewick * @author Kevin Wayne */ public final class Picture implements ActionListener { private BufferedImage image; // the rasterized image private JFrame frame; // on-screen view private String filename; // name of file private boolean isOriginUpperLeft = true; // location of origin private final int width, height; // width and height /** * Initializes a blank <tt>width</tt>-by-<tt>height</tt> picture, with <tt>width</tt> columns * and <tt>height</tt> rows, where each pixel is black. */ public Picture(int width, int height) { if (width < 0) throw new IllegalArgumentException("width must be nonnegative" ;if (height < 0) throw new IllegalArgumentException("height must be nonnegative" ;this.width = width; this.height = height; image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); // set to TYPE_INT_ARGB to support transparency filename = width + "-by-" + height; } /** * Initializes a new picture that is a deep copy of <tt>picture</tt>. */ public Picture(Picture picture) { width = picture.width(); height = picture.height(); image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); filename = picture.filename; for (int col = 0; col < width(); col++) for (int row = 0; row < height(); row++) image.setRGB(col, row, picture.get(col, row).getRGB()); } /** * Initializes a picture by reading in a .png, .gif, or .jpg from * the given filename or URL name. */ public Picture(String filename) { this.filename = filename; try { // try to read from file in working directory File file = new File(filename); if (file.isFile()) { image = ImageIO.read(file); } // now try to read from file in same directory as this .class file else { URL url = getClass().getResource(filename); if (url == null) { url = new URL(filename); } image = ImageIO.read(url); } width = image.getWidth(null); height = image.getHeight(null); } catch (IOException e) { // e.printStackTrace(); throw new RuntimeException("Could not open file: " + filename); } } /** * Initializes a picture by reading in a .png, .gif, or .jpg from a File. */ public Picture(File file) { try { image = ImageIO.read(file); } catch (IOException e) { e.printStackTrace(); throw new RuntimeException("Could not open file: " + file); } if (image == null) { throw new RuntimeException("Invalid image file: " + file); } width = image.getWidth(null); height = image.getHeight(null); filename = file.getName(); } /** * Returns a JLabel containing this picture, for embedding in a JPanel, * JFrame or other GUI widget. * @return the <tt>JLabel</tt> */ public JLabel getJLabel() { if (image == null) { return null; } // no image available ImageIcon icon = new ImageIcon(image); return new JLabel(icon); } /** * Sets the origin to be the upper left pixel. This is the default. */ public void setOriginUpperLeft() { isOriginUpperLeft = true; } /** * Sets the origin to be the lower left pixel. */ public void setOriginLowerLeft() { isOriginUpperLeft = false; } /** * Displays the picture in a window on the screen. */ public void show() { // create the GUI for viewing the image if needed if (frame == null) { frame = new JFrame(); JMenuBar menuBar = new JMenuBar(); JMenu menu = new JMenu("File" ;menuBar.add(menu); JMenuItem menuItem1 = new JMenuItem(" Save... " ;menuItem1.addActionListener(this); menuItem1.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); menu.add(menuItem1); frame.setJMenuBar(menuBar); frame.setContentPane(getJLabel()); // f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.setTitle(filename); frame.setResizable(false); frame.pack(); frame.setVisible(true); } // draw frame.repaint(); } /** * Returns the height of the picture. * @return the height of the picture (in pixels) */ public int height() { return height; } /** * Returns the width of the picture. * @return the width of the picture (in pixels) */ public int width() { return width; } /** * Returns the color of pixel (<tt>col</tt>, <tt>row</tt> .* @return the color of pixel (<tt>col</tt>, <tt>row</tt> ![]() * @throws IndexOutOfBoundsException unless both 0 ≤ <tt>col</tt> < <tt>width</tt> * and 0 ≤ <tt>row</tt> < <tt>height</tt> */ public Color get(int col, int row) { if (col < 0 || col >= width()) throw new IndexOutOfBoundsException("col must be between 0 and " + (width()-1)); if (row < 0 || row >= height()) throw new IndexOutOfBoundsException("row must be between 0 and " + (height()-1)); if (isOriginUpperLeft) return new Color(image.getRGB(col, row)); else return new Color(image.getRGB(col, height - row - 1)); } /** * Sets the color of pixel (<tt>col</tt>, <tt>row</tt> to given color.* @throws IndexOutOfBoundsException unless both 0 ≤ <tt>col</tt> < <tt>width</tt> * and 0 ≤ <tt>row</tt> < <tt>height</tt> * @throws NullPointerException if <tt>color</tt> is <tt>null</tt> */ public void set(int col, int row, Color color) { if (col < 0 || col >= width()) throw new IndexOutOfBoundsException("col must be between 0 and " + (width()-1)); if (row < 0 || row >= height()) throw new IndexOutOfBoundsException("row must be between 0 and " + (height()-1)); if (color == null) throw new NullPointerException("can't set Color to null" ;if (isOriginUpperLeft) image.setRGB(col, row, color.getRGB()); else image.setRGB(col, height - row - 1, color.getRGB()); } /** * Is this Picture equal to obj? * @return <tt>true</tt> if this picture is the same dimension as <tt>obj</tt> * and if all pixels have the same color */ public boolean equals(Object obj) { if (obj == this) return true; if (obj == null) return false; if (obj.getClass() != this.getClass()) return false; Picture that = (Picture) obj; if (this.width() != that.width()) return false; if (this.height() != that.height()) return false; for (int col = 0; col < width(); col++) for (int row = 0; row < height(); row++) if (!this.get(col, row).equals(that.get(col, row))) return false; return true; } /** * Saves the picture to a file in a standard image format. * The filetype must be .png or .jpg. */ public void save(String name) { save(new File(name)); } /** * Saves the picture to a file in a standard image format. */ public void save(File file) { this.filename = file.getName(); if (frame != null) { frame.setTitle(filename); } String suffix = filename.substring(filename.lastIndexOf('.') + 1); suffix = suffix.toLowerCase(); if (suffix.equals("jpg" || suffix.equals("png" ) {try { ImageIO.write(image, suffix, file); } catch (IOException e) { e.printStackTrace(); } } else { System.out.println("Error: filename must end in .jpg or .png" ;} } /** * Opens a save dialog box when the user selects "Save As" from the menu. */ public void actionPerformed(ActionEvent e) { FileDialog chooser = new FileDialog(frame, "Use a .png or .jpg extension", FileDialog.SAVE); chooser.setVisible(true); if (chooser.getFile() != null) { save(chooser.getDirectory() + File.separator + chooser.getFile()); } } /** * Tests this <tt>Picture</tt> data type. Reads a picture specified by the command-line argument, * and shows it in a window on the screen. */ public static void main(String[] args) { Picture picture = new Picture(args[0]); System.out.printf("%d-by-%d\n", picture.width(), picture.height()); picture.show(); } } |
6楼2015-04-05 00:02:06
WanderingHeart
铁杆木虫 (著名写手)
- 应助: 90 (初中生)
- 金币: 13889.8
- 散金: 5
- 红花: 18
- 帖子: 1885
- 在线: 467.1小时
- 虫号: 257464
- 注册: 2006-06-04
- 性别: GG
- 专业: 凝聚态物性 II :电子结构
2楼2015-04-03 16:50:54
3楼2015-04-03 18:35:38
WanderingHeart
铁杆木虫 (著名写手)
- 应助: 90 (初中生)
- 金币: 13889.8
- 散金: 5
- 红花: 18
- 帖子: 1885
- 在线: 467.1小时
- 虫号: 257464
- 注册: 2006-06-04
- 性别: GG
- 专业: 凝聚态物性 II :电子结构
4楼2015-04-03 22:25:36













回复此楼
is column <em>x</em> and row <em>y</em>.