https://docs.aws.amazon.com/ko_kr/rekognition/latest/dg/text-detecting-text-procedure.html
์ด๋ฏธ์ง์์ ํ ์คํธ ๊ฐ์ง - Amazon Rekognition
์ด ํ์ด์ง์ ์์ ์ด ํ์ํ๋ค๋ ์ ์ ์๋ ค ์ฃผ์ ์ ๊ฐ์ฌํฉ๋๋ค. ์ค๋ง์์ผ ๋๋ ค ์ฃ์กํฉ๋๋ค. ์ ๊น ์๊ฐ์ ๋ด์ด ์ค๋ช ์๋ฅผ ํฅ์์ํฌ ์ ์๋ ๋ฐฉ๋ฒ์ ๋ํด ๋ง์ํด ์ฃผ์ญ์์ค.
docs.aws.amazon.com
1. AWS์์ IAM ์ฌ์ฉ์ ๋ง๋ค๊ธฐ
- AWS ์๊ฒฉ ์ฆ๋ช ์ ํ ์ ํ: ์ก์ธ์ค ํค, ์ํธ
- ์ฝ์ ๋น๋ฐ๋ฒํธ ์ค์ ํ๊ธฐ
- ์ ์ฑ ์ถ๊ฐ: AdministerAccess, AmazonRekognitionFullAccess, AmazonS3ReadOnlyAccess
*** ๋ง์ง๋ง์ new_user_credentials.csv ํ์ผ ๋ค์ด ๋ฐ์ ํ ๊ผญ ๊ธฐ์ตํด๋๊ธฐ ***


2. S3 ๋ฒํท ๋ง๋ค๊ธฐ -> ๋ฒํท ์์ ํ ์คํธ ๊ฐ์งํ ์ฌ์ง ์ ๋ก๋
** ์ฐธ๊ณ : ๋ฒํท ์ด๋ฆ์ ๊ณ ์ ํด์ผ ํ๋ฉฐ, ๊ฐ์ฒด ์์ ๊ถ ํ์ฑํ! ์ก์ธ์ค ์ฐจ๋จ ํ์ด์ฃผ๊ธฐ!
3. ํ๋ก์ ํธ ์์ฑ
-> npm install aws-sdk
-> npm install uuid
-> pip install awscli
4. aws configure
-> new_user_credentials.csv ํ์ผ์ Access key ID, Secret access key ๋ฃ์ด์ฃผ๊ธฐ

5. Recog.js ์ฝ๋ ์์ฑ
- bucket, photo ๋ถ๋ถ ์์ ์ด ์ค์ ํ ๋ฒํท ์ด๋ฆ๊ณผ ์ ๋ก๋ํ ํ์ผ๋ช ์ผ๋ก ๋ณ๊ฒฝ
- region ๋ถ๋ถ ์์ ์ด ์ค์ ํ ์ง์ญ์ผ๋ก ๋ณ๊ฒฝ (์์ธ: ap-northeast-2)
- ์ ์ฒจ๋ถ๋งํฌ์ ๋ค์ด๊ฐ๋ฉด ๋ค๋ฅธ ์ธ์ด๋ ์ ๊ณตํ๋ค
var AWS = require('aws-sdk');
const bucket = 'bucket' // the bucketname without s3://
const photo = 'photo' // the name of file
const config = new AWS.Config({
accessKeyId: process.env.AWS_ACCESS_KEY_ID,
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
})
AWS.config.update({region:'region'});
const client = new AWS.Rekognition();
const params = {
Image: {
S3Object: {
Bucket: bucket,
Name: photo
},
},
}
client.detectText(params, function(err, response) {
if (err) {
console.log(err, err.stack); // handle error if an error occurred
} else {
console.log(`Detected Text for: ${photo}`)
console.log(response)
response.TextDetections.forEach(label => {
console.log(`Detected Text: ${label.DetectedText}`),
console.log(`Type: ${label.Type}`),
console.log(`ID: ${label.Id}`),
console.log(`Parent ID: ${label.ParentId}`),
console.log(`Confidence: ${label.Confidence}`),
console.log(`Polygon: `)
console.log(label.Geometry.Polygon)
}
)
}
});
6. ๊ฒฐ๊ณผ
- ํ๊ธ์ ์๋จ,,,




์ถํ ์์ฉํด๋ณด์ยทยทยท
'๐ > cloudIOT' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
AWS ๊ธฐ๋ฐ ์ฃผ์ฐจ ๊ด๋ฆฌ ์์คํ (3) ์ฝ๋ (0) | 2022.06.16 |
---|---|
AWS ๊ธฐ๋ฐ ์ฃผ์ฐจ ๊ด๋ฆฌ ์์คํ (2) Lambda ์ค์ (0) | 2022.06.16 |
AWS ๊ธฐ๋ฐ ์ฃผ์ฐจ ๊ด๋ฆฌ ์์คํ (1) AWS IoT Core (0) | 2022.06.16 |
AWS EC2 - MQTT ์ด์ฉํ๊ธฐ (0) | 2022.05.17 |
๋ผ์ฆ๋ฒ ๋ฆฌํ์ด OS ์ค์น & ๋ ธํธ๋ถ ์๊ฒฉ ์ ์ (0) | 2022.04.04 |