How Can i Store photo (image) in column of table

This assumes that the images in question currently reside on the database server. If you want to upload images into the database from a client machine, you will need an extra step where you move the files to the appropriate directory or directories on the server. This example will store the images in a BLOB column, rather than a much more flexible interMedia ORDImage column. A BLOB column is fine if you only want to store and retrieve the image, but interMedia gives you significantly more flexibility to manipulate the image, extract metadata, etc.

Create the directory

First, you will want to tell Oracle where it can find the images you want to insert into the database. The easiest way to do this is to create a directory object. In this case, I will be loading images from 'c:/temp/img/'.



CREATE DIRECTORY images AS 'c:/temp/img/'


If you don't have the CREATE DIRECTORY privilege, you will need to have someone else, like your DBA, create the directory and grant you READ access to it.



GRANT READ ON DIRECTORY images TO scott;


Create the Table to Hold the Images



CREATE TABLE images (
image_name VARCHAR2( 100 ),
mime_type VARCHAR2( 100 ),
content BLOB
)


Create a Stored Procedure to Load the Image



CREATE OR REPLACE PROCEDURE load_image( file_name VARCHAR2 )
AS
file_lob BFILE;
binary_lob BLOB;
mime_type images.mime_type%type;
extension_pos NUMBER;
BEGIN
-- Use the extension of the file name to determing the MIME-type
-- The MIME-type for a .JPG file will be image/jpg
extension_pos := INSTR( file_name, '.' );
mime_type := 'image/' || SUBSTR( file_name,
extension_pos + 1,
LENGTH( file_name ) );

-- Insert a new row into the images table. Get the LOB locator
-- for the newly inserted row-- we will be using that to insert
-- the content from the file.
INSERT INTO IMAGES( image_name, mime_type, content )
VALUES( file_name, mime_type, empty_blob() )
RETURNING content INTO binary_lob;

-- Open up the file in the IMAGES directory named file_name,
-- load that file into the newly created LOB locator, and
-- close the file
file_lob := BFILENAME( 'IMAGES', file_name );
dbms_lob.fileOpen ( file_lob, dbms_lob.file_readOnly );
dbms_lob.loadFromFile( binary_lob,
file_lob,
dbms_lob.getLength( file_lob ) );
dbms_lob.fileClose ( file_lob );
END;


Load the Image



scott@jcave > exec load_image( 'sample.jpg' );

PL/SQL procedure successfully completed.

scott@jcave > column image_name format a30;
scott@jcave > column mime_type format a15;
scott@jcave > column length format 999999;
scott@jcave >
1 SELECT image_name, mime_type,dbms_lob.getLength( content ) length
2 FROM images;

no rows selected

Elapsed: 00:00:00.00
scott@jcave > /

IMAGE_NAME MIME_TYPE LENGTH
------------------------------ --------------- -------
sample.jpg image/jpg 9894


Regards
Lakmal
 
内容概要:本文探讨了SLAM(实时定位与地图构建)技术在芯片行业后道封装测试环节的应用,聚焦于晶圆缺陷检测机器人导航系统。文章介绍了视觉SLAM的核心概念与关键技术,包括特征点法(如ORB-SLAM)、关键帧、词袋模型和本质矩阵,并详细分析了基于OpenCV实现的ORB特征提取与匹配、RANSAC位姿估计的C++代码。该系统利用视觉传感器构建三维稀疏点云地图,实现机器人在复杂环境中的自主导航与缺陷精准定位。未来趋势指向多模态融合(视觉-激光-IMU)和语义级高精地图与数字孪生平台的集成。; 适合人群:具备计算机视觉或机器人相关基础知识,从事智能制造、自动化巡检、SLAM算法研发的技术人员及工程师,尤其适用于工作1-3年、希望深入理解SLAM工业落地实践的研发人员。; 使用场景及目标:①应用于芯片封测车间的自动巡检机器人,解决设备密集、线缆交错环境下的高精度导航问题;②实现缺陷图像与空间坐标的绑定,提升运维效率与智能化水平;③为SLAM在工业场景中的鲁棒性优化提供可复用的技术路径。; 阅读建议:此资源结合理论与代码实践,建议读者在掌握相机模型、特征提取等前置知识的基础上,动手运行并调试文中代码,深入理解RANSAC、回环检测等关键步骤在真实工业场景中的作用机制,并结合实际硬件系统进行拓展研究。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值