有人可以帮我解决这个功能吗 [英] Can someone help me solve this function please

查看:64
本文介绍了有人可以帮我解决这个功能吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我第一次做matlab而且之前从未编过代码。这是我不得不采取的强制性Uni论文。在完成这项任务之前,我已经设法完成了其他各种任务,但这超出了我在过去三周所学到的内容。

这是我在脚本文件inroder中到目前为止试图解决这个问题的原因。


函数[Points] = SelectKRandomPoints (图片,K)



图片= imread('logo.jpg')%logo.jpg是我们正在处理的图片

Image1 =尺寸(图片)%这将给出图像上的尺寸256 x 102 x 3



这是我所理解的,我甚至不知道它是否正确开始的方式。我不知道怎么做是从图像大小矩阵中选择一堆随机数。我也不明白如何编写这样的代码,如果我在我的函数中输入'k'为5,我将有5行和2列随机数。



如果你能提供帮助就会很棒! :) P.S.我不想要答案,只是建议/指导





SelectKRandomPointsPurpose从图像生成k个随机选择像素的列表。

输入按以下顺序输入两个输入:



1)从中选择点数的3D图像数组
)随机选择输出的点数



它返回一个单输出,一个包含k行和2列的二维数组,代表k个随机选择的点(像素)。



示例:

以下是调用SelectKRandomPoints的一些示例,假设A是表示RGB图像的256x256x3数组,



>> points = SelectKRandomPoints(A,6)points = [150 192; 219 40; 9 37 225; 154 103; 65; 10 40]



我的尝试:



功能[积分] = SelectKRandomPoints(Image,K)



Image = imread('logo.jpg')%logo.jpg是我们正在处理的图像

Image1 = size(Image)%这将给出Image 256 x 102 x 3

This is my first time doing matlab and I've never coded before. This was a compulsory Uni paper that I have had to take. Prior to this task I've managed to complete various other tasks but this is challenging me beyond what I've learned in the last three weeks.
This is what ive got down so far in my script file inroder to attempt to solve this problem.

function [Points] = SelectKRandomPoints (Image, K)

Image = imread('logo.jpg') %logo.jpg is the image we are dealing with
Image1 = size(Image) %This will give the size on the Image 256 x 102 x 3

This is all I understand and I dont even know if its the correct way to start. What I dont know how to do is to select a bunch of random numbers form the image size matrix. I also dont understand how to write such a code that if I input 'k' to be 5 in my function I will have 5 rows and 2 columns of random numbers.

If you could help it would be great! :) P.S. I dont want answers, just advice/guidance


SelectKRandomPointsPurpose generates a list of k randomly selected pixelsfrom an image.
Input(s)It takes twoinputs in the following order:

1)A 3D image array from which to select points from
2)The number of points to randomly selectOutput(s)

It returns a singleoutput, a 2D array, containing k rows and 2 columns, representing k randomly selected points (pixels).

Example :
Here are some examples of calls to SelectKRandomPoints assuming that A is a 256x256x3 array representing an RGB image,

>> points = SelectKRandomPoints(A,6) points = [150 192 ; 219 40 ; 9 37 225 ; 154 103 ; 65 ; 10 40 ]

What I have tried:

function [Points] = SelectKRandomPoints (Image, K)

Image = imread('logo.jpg') %logo.jpg is the image we are dealing with
Image1 = size(Image) %This will give the size on the Image 256 x 102 x 3

推荐答案

的大小因此,您没有尝试解决问题你自己,毫无疑问,你只是想让我们做你的HomeWork。

HomeWork问题是你在现实生活中需要解决的问题的简化版本,目的正在学习并且练习

我们不做你的HomeWork。

HomeWork不会测试你乞求别人做你的工作的技能,它会让你思考和帮助您的老师会检查您对所学课程的理解以及您应用这些课程时遇到的问题。

你的任何失败都会帮助你的老师发现你的弱点并设定补救措施。

你的任何失败都会帮助你了解什么有效,什么无效,被称为'试错'学习。

所以,试一试,重读课程并开始工作。如果您遇到特定问题,请显示您的代码并解释这个问题,我们可能会提供帮助。



作为程序员,您的工作是创建算法解决特定问题,你不能依赖别人永远为你做,所以有一段时间你必须学会​​如何。而且越快越好。

当你要求解决方案时,就像试图通过培训其他人来学习开车一样。

创建算法基本上是找到数学并做出必要的调整以适应你的实际问题。
So, you show no attempt to solve the problem yourself, you have no question, you just want us to do your HomeWork.
HomeWork problems are simplified versions of the kind of problems you will have to solve in real life, their purpose is learning and practicing.
We do not do your HomeWork.
HomeWork is not set to test your skills at begging other people to do your work, it is set to make you think and to help your teacher to check your understanding of the courses you have taken and also the problems you have at applying them.
Any failure of you will help your teacher spot your weaknesses and set remedial actions.
Any failure of you will help you to learn what works and what don't, it is called 'trial and error' learning.
So, give it a try, reread your lessons and start working. If you are stuck on a specific problem, show your code and explain this exact problem, we might help.

As programmer, your job is to create algorithms that solve specific problems and you can't rely on someone else to eternally do it for you, so there is a time where you will have to learn how to. And the sooner, the better.
When you just ask for the solution, it is like trying to learn to drive a car by having someone else training.
Creating an algorithm is basically finding the maths and make necessary adaptation to fit your actual problem.


这篇关于有人可以帮我解决这个功能吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆