Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

md #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

md #1

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Uncrease
43 changes: 43 additions & 0 deletions uncrease.ipynb
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"引入必要的函式庫以及我們寫好的function"
]
},
{
"cell_type": "code",
"execution_count": 1,
Expand All @@ -23,6 +30,14 @@
"from dotenv import load_dotenv"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"導入存在sources的圖片,轉為灰階<br>\n",
"獲取API密鑰"
]
},
{
"cell_type": "code",
"execution_count": 2,
Expand Down Expand Up @@ -60,6 +75,23 @@
"test = 1 # if colored pic or complex choose 2, if simple(means got a subject) choose 1"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Detect Ridges\n",
"**(直接檢測,不取出背景)**\n",
"1. 進行脊(ridge)檢測:設定參數,將圖像利用`detect_ridges函數`檢測,並輸出兩個圖像的特徵值。\n",
"\n",
"2. 計算二值化影像:根據`特徵值計算了兩個二值化影像` i1_binary 和 i2_binary。通過將特徵值與閾值進行比較而得到的,生成的二值化影像用於表示在圖像中脊的特徵。\n",
"\n",
"3. 正規化影像:對二值化影像進行了`正規化處理`,以便於顯示和後續處理。使用了 cv2.normalize 將數值範圍調整到 [0, 1] 之間。\n",
"\n",
"4. 調整數值範圍:將正規化後的影像數值範圍重新縮放到 [0, 255] 之間,以便於顯示為灰度影像。\n",
"\n",
"5. `生成脊檢測的遮罩`:選擇其中一個特徵值影像(使用 i1_scaled)作為脊檢測的遮罩。將這個遮罩影像 ridge_mask 轉換為 PILImage 物件並顯示出來。"
]
},
{
"cell_type": "code",
"execution_count": 3,
Expand Down Expand Up @@ -133,6 +165,17 @@
"display(ridge_mask)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Remove creases not in background\n",
"1. 使用 ClipDrop API 的 `cleanup` 功能\n",
" \n",
"2. **Result**<br>\n",
"將原圖像作為image,ridge_mask 圖像作為mask,並套用模型抹除皺摺紋路,並顯示出來。"
]
},
{
"cell_type": "code",
"execution_count": 4,
Expand Down