얼마전에 사진 정리 도구를 Piwigo에서 PhotoPrism으로 변경했습니다. Piwigo는 매우 좋은 어플리케이션이지만, PhotoPrism의 현대적인 느낌과 AI를 이용한 사진 분류기능이 매력적입니다. PhotoPrism은 Golang으로 개발되어 있으며, REST API를 통해 다양한 프로그래밍 언어로 활용할 수 있습니다. (Browse Your Life in Pictures – PhotoPrism). 그러나 여러 예시가 Golang이라 그것을 활용해 보았습니다. Golang은 처음이로 ChatGPT를 이용해서 Library와 Sample을 만들었습니다.
AzureAI를 사용해 태그를 추가하고, Piwigo의 사진을 PhotoPrism에 업로드 하는 것이 골이 었고, AzureAI를 사용한 이유는 일정범위(개인용으로 충분한)에서 무료 사용기 가능하다는 점입니다.
go mod init azure-golang go mod tidy export VISION_KEY="YOURKEY" go run
실행 코드
package main
import (
"github.com/flywithu/azure-golang"
"fmt"
"log"
"os"
"net/http"
"io"
)
func main() {
VISION_ENDPOINT := "https://flywithufreevision.cognitiveservices.azure.com"
VISION_KEY := os.Getenv("VISION_KEY")
filePath:="temp.jpg"
// URLs for image analysis
landmarkImageURL := "https://raw.githubusercontent.com/Azure-Samples/cognitive-services-sample-data-files/master/ComputerVision/Images/landmark.jpg"
kitchenImageURL := "https://learn.microsoft.com/en-us/azure/ai-services/computer-vision/images/windows-kitchen.jpg"
eiffelTowerImageURL := "https://upload.wikimedia.org/wikipedia/commons/thumb/d/d4/Eiffel_Tower_20051010.jpg/1023px-Eiffel_Tower_20051010.jpg"
redShirtLogoImageURL := "https://publish-p47754-e237306.adobeaemcloud.com/adobe/dynamicmedia/deliver/dm-aid--08fdf594-c963-43c8-b686-d4ba06727971/noticia_madridistas_hp.app.png?preferwebp=true&width=1440"
client := vision.ComputerVisionClient(VISION_ENDPOINT, VISION_KEY)
log.Println("++++++++++++++++++++++++++++++++++++++++++++++++")
log.Println("Download File")
resp, err := http.Get(landmarkImageURL)
if err != nil {
panic(err)
}
defer resp.Body.Close()
out, err := os.Create(filePath)
if err != nil {
panic(err)
}
defer out.Close()
_, err = io.Copy(out, resp.Body)
if err != nil {
panic(err)
}
// Tagging an image
log.Println("++++++++++++++++++++++++++++++++++++++++++++++++")
log.Println("Image Tagging")
tags, err := client.GetImageTags(filePath)
if err != nil {
log.Fatalf("Failed to get image tags: %v", err)
}
for i, tag := range tags.Tags {
if i >= 3 { break }
fmt.Printf("Tag: %s (Confidence: %.2f)\n", tag.Name, tag.Confidence)
}
// Describing an image
log.Println("++++++++++++++++++++++++++++++++++++++++++++++++")
log.Println("Image Description")
description, err := client.GetImageDesc(filePath)
if err != nil {
log.Fatalf("Failed to get image description: %v", err)
}
for i, tag := range description.Description.Tags {
if i >= 3 { break }
fmt.Printf("Description Tag: %s\n", tag)
}
for i, caption := range description.Description.Captions {
if i >= 3 { break }
fmt.Printf("Caption: %s (Confidence: %.2f)\n", caption.Text, caption.Confidence)
}
// Object Detection
log.Println("++++++++++++++++++++++++++++++++++++++++++++++++")
log.Println("Object Detection")
objects, err := client.GetImageObject(kitchenImageURL)
if err != nil {
log.Fatalf("Failed to detect objects: %v", err)
}
for i, obj := range objects.Objects {
if i >= 3 { break }
fmt.Printf("Object: %s (Confidence: %.2f)\n", obj.ObjectInfo.ObjectName, obj.ObjectInfo.Confidence)
if obj.Parent != nil {
fmt.Printf("Parent Object: %s (Confidence: %.2f)\n", obj.Parent.ObjectName, obj.Parent.Confidence)
}
}
// Analyzing image for landmarks
log.Println("++++++++++++++++++++++++++++++++++++++++++++++++")
log.Println("Landmark Analysis")
landmarks, err := client.GetImageAnalyze(eiffelTowerImageURL)
if err != nil {
fmt.Printf("Failed to analyze landmarks: %v", err)
}
for i, cat := range landmarks.Categories {
if i >= 3 { break }
fmt.Printf("Category: %v\n", cat)
if cat.Detail != nil && len(cat.Detail.Landmarks) > 0 {
fmt.Printf("Landmark: %v\n", cat.Detail.Landmarks[0].Name)
}
}
// Analyzing brands
log.Println("Analyze - Brands")
brands, err := client.GetImageAnalyze(redShirtLogoImageURL)
if err != nil {
fmt.Printf("Failed to analyze brands: %v", err)
}
fmt.Printf("Brand : %v \n",brands.Brands)
for i, tag := range brands.Tags {
if i >= 3 { break }
fmt.Printf("Brand Tag: %v \n", tag)
}
}
I recently switched my photo organization tool from Piwigo to PhotoPrism. While Piwigo is a very good application, I found PhotoPrism’s modern UI and AI-powered photo capabilities appealing. PhotoPrism is developed in Golang and can be utilized with various languages through its REST API. However, since many examples are in Golang, I decided to use that. As it was my first time using Golang, I wrote libraries and samples with ChatGPT guidance.
Adding tags with Azure AI and uploading photos to PhotoPrims was the goal, and the reason for using Azure AI is that it offers free usage, which is sufficient for personal use.
Android의 CTS를 TC를 확인하면서, DRM항목 중 Clearkey TC에 관심이 생겼습니다. DRM은 디지털 콘텐츠의 무단 복제를 방지 하는 기술로, 저작권 보호에 핵심적인 역할을 합니다. 이 기술에 실제로 어떻게 작동하는지 궁금해서 다음과 같은 리소스도 참고 했습니다.
Clearkey는 간단하고 비용 효율적인 DRM으로, 주로 보안 요구사항이 낮은 콘텐츠에 적용됩니다. 반면 Google에서 개발한 Widevine은 훨씬 높은 보안을 제공합니다. Widevine은 세가지 보안 수준(L1,L2,L3)를 가지며, 이는 HW와 SW사용 여부에 달라집니다. L1과 L2는 HW를 사용하여 보안을 강화하지만, L3는 소프트웨어만을 사용하고 보통 480p해상도 까지 지원 합니다.
Coupang Play의DRM
현재 OTT는 Netflix, Disney, Tving, CoupangPlay, youtube 를 구독 중입니다. 최근 Coupang Play가 가격인상을 하였기에, 향후에도 계속 사용할지 모르겠습니다. 그래서 권한이 있을때 확인 해보고자 했습니다.
DRM 및 관련 자료를 찾는 사전 준비대비, 코덱 코드에 이미 DUMP 준비가 다 되어 있고, Define만 살렸더니 실험해보려던거가 한번에 되어서 좀 허망함이 있었습니다.
그러나 이번에 DRM의 구조 이해와 미디어쪽을 알게 되었습니다. 이론적으로는 FakeCodec과 같은 사용자 정의 코덱을 만들면 DRM 보호 데이터를 덤프 할수 있음을 확인 했습니다.
DRM으로 보호된 것을 사적 복사를 넘어선 제 3자에게 공유하는 것은 금지되어 있습니다. 그리고 다른 ID로 덤프해서 비교해보면 확실하겠지만, 아마 워터마크가 있을 것이고 이를 통한 추적도 가능 할것 입니다. 이러한 워터마크의 제거를 하려면 인코딩과 디코딩을 반복해서 해야 하고, 그러면 화질 저하가 발생하기 때문에 이것도 방법은 아닙니다..
English
Motivation
While stuying the Android CTS, I became interested in the ClearKey TC within DRM. DRM is a protective technology designed to prevent copying. I’ve reviewd below items.
DRM stands for ‘Digital Rights Management’ , a technology designed to prevent unauthrozied copying and distribution of digital content. And only authorized users recevied the key to access it.
Clearkey is a simple and cost efficient DRM solution, used for content with low security requirments. On the other hand, Widevine, developed by Google, offers much higher security. Widevine has three levels of security(L1,L2,L3) that depend on whether HW or SW is used. L1 and L2 enhances security by HW, L3 uses only SW and typically supports up to 480p resolution.
Coupang Play with DRM
With the recent price increase at Coupang Play, I’m unsure if I’ll continue my subscription. Therefore I hope to thoroughly invetigate the service while I sill have access.
Initially, I intened to experiment only with the ClearKey method. as studying Widevine seemd too challenging. However, rather than giving up, I decied to shift my focus to chekcing if video dumping was possible.
This is the Widevine architecture and lower-right HAL, known s OEMCrypto HAL, decrypts the data and tranfers it to Media Out.
This is the codec architecture. The decrypted data is decoded by the codec and then displayed on screen. I may not be able to decrypt Widevine, I colud intercept and save the input to obtain the decrypted data.
After examing the codec section , I modified the following part to make it operational .
English follows Korean. 이번 포스트는 MNIST 데이터셋입니다. MNIST는 머신러닝과 컴퓨터 비전 분야에서 'Hello world'와 같은 존재 입니다. 이처럼 광범위하게 사용되는 만큼, 다양한 예제와 구현 방법이 널리 알려져 있습니다. 최근에 CPP로 된 MNIST를 돌려 보다가, 기존 python 보다 훨씬 빠른거 같은 느낌이 들어서 실제적인 시간을 측정해 보았습니다. 사실 python 은 GIL, 싱글쓰레드, 인터프리터, 동적 타이핑등의 이유로…
이제야 이것을 올립니다. . 사실, 이전부터 올리려고 했는데 여러 이유로 지연이 되었습니다. 현 상태에서 마무리를 하고 올리려고 합니다. AAOS(Android Automotive OS) Emulator 이고, GPS 위치가 수도권 순환도로 판교, 중동을 왕복 하도록 설정 되어 있습니다. 시작 했던 이유는, 이전에 tmap을 OEM GPS(apple pie - ApplePie Carplay Android Ai Box Apple pie Car Smart Box) 가 가능하게…
wordpress로 블로그를 올리고 미디어 파일을 올립니다. 그런데 미디어파일을 별도로 올리거나 하는 경우 아래와 같이 미디어 파일과 블로그의 글의 링크가 깨지는 경우가 있습니다. 아래의 스크립트를 돌리면 이러한 글들을 미디어파일과 블로그 글을 링크로 연결 해줍니다. # -*- encoding:utf8 -*- from curses.ascii import isdigit from select import select from turtle import Screen, isvisible import requests import random from…
최근 몇일동안 사이트 사용에 문제가 있었습니다. 예를들어 댓글이 작성이 안되는 문제였습니다. 그 이유는 웹호스팅 디스크 Full 때문이었습니다. 그동안 중복해서 올린 media 라이브러리가 많았는데, 사용하지 않는 미디어파일을 삭제 하는 노트북 파일 입니다. 파일명으로만 검색하기 때문에, 동일한 파일명으로 사용중일때는 있는 것으로 판단합니다. 즉 좀 더 보수적으로 판단 됩니다. 정확하게는 경로명까지 봐서 판단해야 하는데, 이거는 다음에 올린 다음…
https://flywithu.com/gpt-%ec%82%ac%ec%9a%a9-%ed%9b%84%ea%b8%b0/ 이글에서 언급된 파이썬 코드 입니다. 개발 환경은 Kaggle 서버 입니다. (www.kaggle.com) 여기의 장점은 스케줄링이 되서, 매일 한번씩 코드가 자동 실행 됩니다. 그것도 무료로!스케줄링 설정은 아래와 작성한 파이썬에 대해서 설정해줍니다. 그러면 UTC 0 (9:00AM KST)에 실행이 됩니다. 사실 코드가 별로 길지도 않아서.. 먼저 OpenAI의 API Key를 가져 옵니다. (https://platform.openai.com/account/api-keys) 그리고 wordpress의 Key도 가져 옵니다. https://github.com/metaqsol/card/blob/main/gpt-to-wordpress.ipynb…
아무말 대잔치로 GPT를 통해서 Post를 해보았습니다. 몇번의 시행착오를 겪었는데, 처음에는 네이버 기사를 가져와서 글을 쓰게 했는데.. 정말 정말 아무말 대잔치.GPT는 2021년까지 밖에 모르니, 최신 뉴스를 가져와서 글을 쓰게 하니. 그래서 그 다음으로 한거는 이미 알고 있고, 그리고 재미도 있을만한 옛날 이야기를 작성하게 했습니다. https://flywithu.com/category/chatgpt/아래와 같이 글을 작성해주는데, GPT도 알고 있던 시대이니, 본문도 맞지 않을까 싶습니다.…