Info
此问题已关闭。 请重新打开它进行编辑或回答。
doubt regards the program for the regionprops
1 次查看(过去 30 天)
显示 更早的评论
sir I done these following steps
function area()
originalImage = imread('result.png');
binaryImage = originalImage<140;
labeledImage = bwlabel(binaryImage, 8);
D=regionprops(labeledImage,'all');
end
i need to save all regionprops values like area, perimeter,etc... to the database how its been done and what is procedure for save all that values in database
0 个评论
此问题已关闭。
回答(2 个)
Image Analyst
2012-11-21
save(matFileName, D);
2 个评论
ajith
2012-11-21
when i execute the save('result.mat',D)
shows the error
save('data.mat', D)
??? Error using ==>
save Argument must contain a string.
how to resolve it sir
Image Analyst
2012-11-21
Oh, I forgot. For some reason, save() wants the variables enclosed in single quotes, so they're strings with the name of the variable rather than the variable itself. I don't know why - it shouldn't be necessary in my opinion - but, for whatever reason, that's the way they do it. So just do this:
save(matFileName, 'D');
Walter Roberson
2012-11-21
save('result.mat', D) %result.mat will be your database, with a single set of data in it.
22 个评论
Walter Roberson
2012-11-22
There is a database toolbox. I do not know if there is another way. I guess it could be done via ActiveX on MS Windows systems.
First you will need to define what your database keys are : if you are storing for multiple images, then how do you wish to be able to refer to a specific result later?
ajith
2012-11-22
database keys like the regionprops values like area, perimeter etc... and the images are been stored in the ms access i dont know how to save in ms access
Walter Roberson
2012-11-22
You are only going to store the regionprops information for a single image into any one database? That sounds like pretty high overhead.
Are you already retrieving the images from an MS Access database, and you wish to process each image and write back the regionprops for each image into the record associated with that image? If so then showing your existing code to retrieve an image would help.
ajith
2012-11-22
i need to store the regionprops data to MS access. but actually i retrieve the images from the folder only so that only i ask regards to the database connectivity
Image Analyst
2012-11-22
And he answered that question by referring you to the Database Toolbox or to write it yourself with ActiveX. He's not going to write a toolbox for you or write an ActiveX function for you. There are ActiveX examples out there so you can do that yourself if you cannot afford the toolbox. But it's not something someone could bang out in just a few minutes so that's why we can't do it for you.
Walter Roberson
2012-11-22
Please clarify: is the database to store information for one image, or for multiple images? If it is for multiple images, then what information do you wish to add in to the database in order for you to be able to retrieve the regionprops information for any particular image ?
ajith
2012-11-23
I store it for the multiple images and I add all the regionprops properties in the database because for the training purpose I didn't know the database connectivity please clarify what should i do
Walter Roberson
2012-11-23
Do you have the Database Toolbox?
Suppose that you did manage to store all of the information in an MS Access database. Suppose you now wish to retrieve the information for one particular image. What unique information about the image would you provide to retrieve the information about that image? For example, will you know that it is image #17 and would want to supply the 17 to retrieve the information? Or would you want to provide the filename that the image was stored in to do the retrieval? Or is there a "title" of some sort for each image and you would search on the title?
ajith
2012-11-23
1. I want to save one image and the corresponding data to the MS Access
2. And then Next save the next image and the corresponding data to the MS Access
3. All the images and the particular values are stored in the order of the database MS Access
I think its may be clear and also been thank for your quick replay
Walter Roberson
2012-11-23
You wrote above that "i need to store the regionprops data to MS access. but actually i retrieve the images from the folder only"
That implies that you are not saving the image to the MS Access database, just the regionprops data for the image.
When you say "are stored in the order of the database", do you mean that your database index field will be a sequence number that you will allow MS Access to fill in automatically? And you will be fine with the possibility that MS Access might happen to store the information for (say) the 17th image between (say) the information for the 5th and 6th image? And that the information for the first image you insert might end up as (say) the 9th database entry?
Have you ever used a database before? Are you familiar with the idea of database search keys or index fields? Can you show us a sample SQL query that you would use to retrieve the information for a particular image?
Do you have the Database Toolbox?
Image Analyst
2012-11-23
Once it's in the database (I assume data for all images will be in the same .mdb file), then what will you do? Are you going to use Access and open up the database and do stuff with Access? Or are you still going to want to read the database and do stuff in MATLAB? If you're going to use MATLAB, and not use Access, then save it as a .mat file, not as an .mdb file. If you just want to do queries, such as "show me all images with an area fraction greater than 5%" then you can do that kind of thing in MATLAB you know.
Walter Roberson
2012-11-23
If you do not have the database toolbox, then there is no tutorial. You will need to use activex() to activate a COM object instance of MS Access and use whatever methods MS Access provides, which is determined entirely by MS Access.
I would suggest that you go over to MS Access documentation on microsoft.com and read about how to use MS Access until you understand the basics of indexing (as a concept) and understand how to create a database schema.
ajith
2012-11-26
sir i have MS Access i create the mdb file in that mdb file i set the key values as area, perimeter, etc... and also I create driver for ODBC in the ODBC driver my main doubt is how to connect and store the values in the MS Access
Image Analyst
2012-11-26
I have not done this so I can't help you. Again, are you sure it MUST be an Access .mdb file you must use and you can't do it with MATLAB .mat file?
ajith
2012-11-26
If there is any other way are there for store the MATLAB.mat file to the anyother database
Walter Roberson
2012-11-26
Normally you would use an SQL type statement in the database toolbox to store the values. But you do not have the database toolbox, so you are going to have to learn MS Access's ActiveX API and do the storing using those calls. That is not something I have had reason to do, myself, and I do not wish to volunteer to investigate it.
What is it that you plan to do with the data once you have it in a database?
Image Analyst
2012-11-26
You didn't answer his question: "What is it that you plan to do with the data once you have it in a database?" Plus, there is always example code that comes with toolboxes that explains how to do it. Have you gone through all the examples yet? They should teach you.
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!发生错误
由于页面发生更改,无法完成操作。请重新加载页面以查看其更新后的状态。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
亚太
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)