SOS!Please help me!

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Thoa
Posts: 11
Joined: Tue 03 Oct 2006 14:54
Location: hochiminh city
Contact:

SOS!Please help me!

Post by Thoa » Tue 03 Oct 2006 15:09

I saved a raster image on Georaster table. And I need coding with asp.net to load image on Web. I read document and see OraDirect.Net can access ASP and Oracle database. I do not know how to read Georaster data to ASP.Net. Please help me!
Thank you so much!
Thoa.

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Thu 05 Oct 2006 11:57

What field type do you have in your table to store raster object? The best way to work with images is to store them in a BLOB field if you do not need to keep any extra metadata provided by MDSYS schema.
The example of using BLOBs for storing raster images is in BlobPictures demo project. After retrieving an image you can use it in ASP however you like.
MDSYS schema is built using Oracle Object types. For more information about working with objects take a look at Object demo project.

Thoa
Posts: 11
Joined: Tue 03 Oct 2006 14:54
Location: hochiminh city
Contact:

SOS! Please help me!

Post by Thoa » Fri 06 Oct 2006 17:30

Hi!
Thank for your help.
My Image saved into Georaster Object including Metadata and cell data. It include GeoRaster Table and Raster Table. Cell data belong to Blob object. But my project is image processing with raster image having spatial. So that, I can not give up metadata and choose Blob object. Now, I do not how to read image data from BLOB and metadata by ASP.NEt? Please help me! My Project need processing with spatial (LONGTITUDE,LATITUDE). How I can do it?
Thank you very much!!!
Thoa.

Thoa
Posts: 11
Joined: Tue 03 Oct 2006 14:54
Location: hochiminh city
Contact:

SOS!

Post by Thoa » Sat 07 Oct 2006 17:29

Please let me know where BlobPicture demo project and Object Demo Project. I have found but no result!
Thank you so much!
Thoa

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Mon 09 Oct 2006 09:13

The sample projects are here:
"D:\Program Files\CoreLab\OraDirect.NET2\Samples\BlobPictures"
"D:\Program Files\CoreLab\OraDirect.NET2\Samples\Object"
Did you receive my request about your database structure by e-mail?

Thoa
Posts: 11
Joined: Tue 03 Oct 2006 14:54
Location: hochiminh city
Contact:

SOS! Please help me!

Post by Thoa » Mon 09 Oct 2006 17:01

Hi Alexey!
Thank you very much for your soon help!
I just receive you confirm registration by email.
It means I must send your my Georaster Data about my Image?
Alexey, I load my image (430,260) into Georaster succesfully and view by MapViewer is fine. My image was stored in Georaster Table and Georaster data table (I do it following Oracle demo guide) but no I do not how can get image data from Georaste for image processing? (use ASP.NET). I installed Oracle Data Provider for .NET.
Please help me for detail!
Thanks so much!
Thoa!

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Tue 10 Oct 2006 06:09

Could you provide us with Oracle demo guide you used?
Also describe what exactly you need to do with the image? Did you experience any difficulties while getting acquainted with BlobPictures demo?

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Tue 10 Oct 2006 07:31

OraDirect doesn't have means that simplify operations with GeoRaster. It works with standard Oracle types without deepening into their matter or destination. That's why you have to know the structure of you raster table (i.e. how it was created with CREATE TABLE statement), know how it stores images, and know data format and contents of used SDO_GEOMETRY, SDO_GEORASTER, SDO_RASTER objects.
We can only suggest you how to retrieve data from needed field of the needed table (bytes array from BLOB, field from an object).
How to interpret this data you should read in documentation.

Thoa
Posts: 11
Joined: Tue 03 Oct 2006 14:54
Location: hochiminh city
Contact:

SOS! Please help me!

Post by Thoa » Wed 11 Oct 2006 10:04

I have read Blob Picture demo but it seems very sad to me. It seems not relative with my Georaster data. I load image into Georaster success and now I must image processing for it. I do not know what info I need for image processing, how to get data from GeoRaster Object. Oracle guide demo about load image following:
-------------------------------------------------------------------
-- create user BETHOA/Kimthoa
-------------------------------------------------------------------

connect BeThoa/kimthoa;

-------------------------------------------------------------------
-- create a georaster table
--
-- A georaster table is a table which has a column of
-- SDO_GEORASTER object type.
-------------------------------------------------------------------

drop table georaster_table;
create table georaster_table
(georid number primary key,
type varchar2(32),
georaster mdsys.sdo_georaster);


-------------------------------------------------------------------
-- create georaster the GeoRaster DML trigger on the georaster table
--
-- This is a MUST for all georaster tables.
-- They are used to manage the georaster sysdata table.
-------------------------------------------------------------------

call sdo_geor_utl.createDMLTrigger('georaster_table', 'georaster');


-------------------------------------------------------------------
-- create some RDTs - Raster Data Tables
--
-- They are used to store cell data of GeoRaster objects
-- This step is not a MUST requirement. If the RDT table doesn't
-- exist, the GeoRaster procedures or functions will generate it
-- automatically whenever needed.
-- But for huge GeoRaster objects, some tuning and setup on those
-- tables can improve the scalability and performance significantly.
-- In those cases, it's better for users to create the RDTs.
-- The primary key must be added to the RDT if user creates it.
-------------------------------------------------------------------

drop table rdt_1;

create table rdt_1 of mdsys.sdo_raster
(primary key (rasterId, pyramidLevel, bandBlockNumber,
rowBlockNumber, columnBlockNumber))
lob(rasterblock) store as (nocache nologging);

-------------------------------------------------------------------
-- initial setup for reading external image or georaster data files
--
-- individual files or a whole directory (external objects) must be
-- granted reading permissions before calling importFrom.
-- This is due to Oracle RDBMS server security concern.
-------------------------------------------------------------------

connect system/manager;


call dbms_java.grant_permission('BETHOA','SYS:java.io.FilePermission',
'D:\DaLat.GIF', 'read' );
call dbms_java.grant_permission('MDSYS','SYS:java.io.FilePermission',
'D:\DaLat.GIF', 'read' );



-------------------------------------------------------------------
-- call importFrom to import image files into GeoRaster objects
-------------------------------------------------------------------

connect BETHOA/kimthoa;

declare
geor MDSYS.SDO_GEORASTER;
begin

-- initialize empty georaster objects to which the external images
-- are to be imported

delete from georaster_table where georid = 1 ;
insert into georaster_table
values( 1, 'GIF', mdsys.sdo_geor.init('rdt_1', 1) );


--
-- import the GIF image
--
select georaster into geor
from georaster_table where georid = 1 for update;
mdsys.sdo_geor.importFrom(geor, '', 'GIF', 'file',
'D:\DaLat.GIF');
update georaster_table set georaster = geor where georid = 1;
commit;


commit;
end;
/
show errors;



-------------------------------------------------------------------
-- revoke reading permissions on external image files for security
-------------------------------------------------------------------

connect system/manager;



call dbms_java.revoke_permission('BETHOA','SYS:java.io.FilePermission',
'D:\DaLat.GIF', 'read' );
call dbms_java.revoke_permission('MDSYS','SYS:java.io.FilePermission',
'D:\DaLat.GIF', 'read' );



-------------------------------------------------------------------
-- some quick checks to see if the data is loaded correctly
-------------------------------------------------------------------

connect herman/vampire;

set long 20000
set lines 20000
set pages 20000
SET NUMWIDTH 6
SET UNDERLINE =

-- display georaster metadata
column georaster format a70 heading " The GeoRaster object"
select georid, georaster
from georaster_table
where georid = 1 or georid = 2
order by georid;

-- display each cell block of the georaster objects
column BLOCKMBR format a40 heading " BLOCK MBR"
select rdt.rasterid, rdt.rowBLockNumber rowblockNum,
rdt.columnBlockNumber colBlockNum, rdt.blockMBR blockmbr,
dbms_lob.getLength(rdt.rasterBlock) cellLength
from rdt_1 rdt, georaster_table grt
where rdt.rasterid = grt.georaster.rasterid
order by rdt.rasterid, rdt.rowblocknumber asc;

commit;
PLEASE HELP ME!! THANK YOU SO MUCH!!!
Thoa!

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Wed 11 Oct 2006 14:43

It seems to us that Oracle stores image data in some inner structures, so that you cannot view images just having retrieved RASTERBLOCK field from a raster data table. You have to use mdsys.sdo_geor.exportTo() function instead.

Thoa
Posts: 11
Joined: Tue 03 Oct 2006 14:54
Location: hochiminh city
Contact:

SOS! Please help me!

Post by Thoa » Thu 12 Oct 2006 15:26

Hi Alex!
Thank for your help!
After I load my image (430,260) into Georaster, I view it in MapViewer fine.
As I know, sdo_geor.exportTo() just a function help me view Image (the same MapVIewer) not to get image data for image processing. I really do not know how to get image data for image processing. Could you give me some PL/SQL to get image data from Georaster table?
Please help me for details!
Thanks!
Thoa.

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Fri 13 Oct 2006 15:19

What image processing are you going to perform with the images? Please describe in detail.
Why don't you use MathWorks Image Processing Toolbox?

Thoa
Posts: 11
Joined: Tue 03 Oct 2006 14:54
Location: hochiminh city
Contact:

SOS! Please help me!

Post by Thoa » Sat 14 Oct 2006 06:17

Hi Alexey!
I need use K-mean algorithm to segment my image (which has been saved in Georaster table). I use ASP.NET to implement it. It is programming not use toolbox. It is my graduate project at my university!
If you know any about that, please help me!
Thank you!
Thoa

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Mon 16 Oct 2006 08:41

Why do you save your images in GeoRaster table? K-mean algorithm works with image characteristics, it does not require any metadata provided by GeoRaster.

Thoa
Posts: 11
Joined: Tue 03 Oct 2006 14:54
Location: hochiminh city
Contact:

SOS! Please help me!

Post by Thoa » Mon 16 Oct 2006 12:22

Hi Alexey!
I save my image to Georaster table. But I can get cell value at each pixel. Each cell value have (Red,Green,Blue) so that I can use K-mean. I do not know my think right or wrong?
(I do not use metadata for K-mean, just use cell value of all image).
Thanks!
Thoa.

Post Reply