第6章 Python 數字圖像處理(DIP) - 彩色圖像處理3 -色彩變換、彩色校正、彩色圖像平滑和銳化、HSI彩色空間中的分割、RGB空間中的分割、彩色邊緣檢測

這里寫目錄標題

  • 色彩變換
  • 彩色圖像平滑和銳化
  • 使用彩色分割圖像
      • HSI 彩色空間中的分割
      • RGB空間中的分割
      • 彩色邊緣檢測
  • 彩色圖像中的噪聲

色彩變換

# 圖像顏色分量的顯示
from PIL import Imageimg_ori = Image.open('DIP_Figures/DIP3E_Original_Images_CH06/Fig0630(01)(strawberries_fullcolor).tif')
img_cmyk = img_ori.convert("CMYK")img_temp = np.array(img_cmyk)
img_c = img_temp[:, :, 0]
img_m = img_temp[:, :, 1]
img_y = img_temp[:, :, 2]
img_k = img_temp[:, :, 3]plt.figure(figsize=(20, 25))
plt.subplot(541), plt.imshow(img_cmyk), plt.title('Original CMYK')# CMYK, seems is CMY, as K is all black
plt.subplot(545), plt.imshow(img_c, 'gray'), plt.title('Cyan')
plt.subplot(546), plt.imshow(img_m, 'gray'), plt.title('Magenta')
plt.subplot(547), plt.imshow(img_y, 'gray'), plt.title('Yellow')
plt.subplot(5, 4, 8), plt.imshow(img_k, 'gray'), plt.title('Black')# Show RGB channels
img_rgb = np.array(img_ori)
plt.subplot(5, 4, 9), plt.imshow(img_rgb[:, :, 0], 'gray'), plt.title('Red')
plt.subplot(5, 4, 10), plt.imshow(img_rgb[:, :, 1], 'gray'), plt.title('Green')
plt.subplot(5, 4, 11), plt.imshow(img_rgb[:, :, 2], 'gray'), plt.title('Blue')# Show HSI channels
img_hsi = img_ori.convert("HSV")
img_hsi = np.array(img_hsi)
plt.subplot(5, 4, 13), plt.imshow(img_hsi[:, :, 0], 'gray'), plt.title('Hue')
plt.subplot(5, 4, 14), plt.imshow(img_hsi[:, :, 1], 'gray'), plt.title('Saturation')
plt.subplot(5, 4, 15), plt.imshow(img_hsi[:, :, 2], 'gray'), plt.title('Intensity')plt.tight_layout()
plt.show()

在這里插入圖片描述

from PIL import Imageimg_ori = Image.open('DIP_Figures/DIP3E_Original_Images_CH06/Fig0630(01)(strawberries_fullcolor).tif')
img_cmyk = img_ori.convert("CMYK")img_temp = np.array(img_cmyk)
img_c = img_temp[:, :, 0]
img_m = img_temp[:, :, 1]
img_y = img_temp[:, :, 2]
img_k = img_temp[:, :, 3]plt.figure(figsize=(20, 25))
plt.subplot(541), plt.imshow(img_cmyk), plt.title('Original CMYK')# CMYK, seems is CMY, as K is all black
plt.subplot(545), plt.imshow(img_c, 'gray'), plt.title('Cyan')
plt.subplot(546), plt.imshow(img_m, 'gray'), plt.title('Magenta')
plt.subplot(547), plt.imshow(img_y, 'gray'), plt.title('Yellow')
plt.subplot(548), plt.imshow(img_k, 'gray'), plt.title('Black')# change K value
img_k_new = img_k * 1 + 150
img_cmyk_new = np.dstack((img_c, img_m, img_y, img_k_new))plt.subplot(549), plt.imshow(img_cmyk_new, 'gray'), plt.title('New CMYK')plt.tight_layout()
plt.show()

在這里插入圖片描述

def gamma_img(img, c, gamma):img = np.array(img).astype(float)output_img = c * img ** gammaimg_scale = np.uint8((output_img / output_img.max()) * 255)return img_scale
def sigmoid_plot(img, scale):x = np.linspace(img.min(), img.max(), 500)x1 = x - 125y = 1 / (1 + np.exp(-x1 / scale))return x, yplt.plot(x, y)plt.grid()
def sigmoid_transform(img, scale):img = np.array(img).astype(float)img_temp = (img - 125.)img_new = 1 / (1 + np.exp(-img_temp / scale))img_new = np.uint8(normalize(img_new) * 255)return img_new
# 色調和彩色校正
from PIL import Imageimg_ori = Image.open('DIP_Figures/DIP3E_Original_Images_CH06/Fig0635(top_ left_flower).tif')plt.figure(figsize=(15, 5))
plt.subplot(131), plt.imshow(img_ori), plt.title('Original')img_colour = sigmoid_transform(img_ori, 30)plt.subplot(132), plt.imshow(img_colour), plt.title('Colour Correct')# x, y = sigmoid_plot(np.array(img_ori), 40)
# plt.subplot(133), sigmoid_plot(np.array(img_ori), 40), plt.title("Transform")x, y = sigmoid_plot(np.array(img_ori), 40)
plt.axes([0.68, 0.15, 0.15, 0.3]), plt.plot(x, y), plt.title("Transform"), plt.grid()# plt.tight_layout()
plt.show()

在這里插入圖片描述

# 色調和彩色校正
from PIL import Imageimg_ori = Image.open('DIP_Figures/DIP3E_Original_Images_CH06/Fig0635(middle_row_left_chalk ).tif')plt.figure(figsize=(10, 5))
plt.subplot(121), plt.imshow(img_ori), plt.title('Original')img_colour = gamma_img(img_ori, 1, 1.5)plt.subplot(1, 2, 2), plt.imshow(img_colour), plt.title('Colour Correct')plt.tight_layout()
plt.show()

在這里插入圖片描述

# 色調和彩色校正
from PIL import Imageimg_ori = Image.open('DIP_Figures/DIP3E_Original_Images_CH06/Fig0635(bottom_left_stream).tif')plt.figure(figsize=(10, 5))
plt.subplot(121), plt.imshow(img_ori), plt.title('Original')img_colour = gamma_img(img_ori, 1, 0.5)plt.subplot(1, 2, 2), plt.imshow(img_colour), plt.title('Colour Correct')plt.tight_layout()
plt.show()

在這里插入圖片描述

彩色圖像平滑和銳化

import numpy as npdef arithmentic_mean(image, kernel):""":param image: input image:param kernel: input kernel:return: image after convolution"""img_h = image.shape[0]img_w = image.shape[1]m = kernel.shape[0]n = kernel.shape[1]# paddingpadding_h = int((m -1)/2)padding_w = int((n -1)/2)image_pad = np.pad(image.copy(), (padding_h, padding_w), mode="constant", constant_values=0)image_convol = image.copy()for i in range(padding_h, img_h + padding_h):for j in range(padding_w, img_w + padding_w):temp = np.sum(image_pad[i-padding_h:i+padding_h+1, j-padding_w:j+padding_w+1] * kernel)image_convol[i - padding_h][j - padding_w] = 1/(m * n) * tempimage_convol = np.uint8(normalize(image_convol) * 255)return image_convol
# 圖像顏色分量的顯示
from PIL import Image# img_ori = Image.open('DIP_Figures/DIP3E_Original_Images_CH06/Fig0638(a)(lenna_RGB).tif')
img_ori = cv2.imread('DIP_Figures/DIP3E_Original_Images_CH06/Fig0638(a)(lenna_RGB).tif')
img_ori = img_ori[:, :, ::-1]# Show RGB channels
plt.figure(figsize=(10, 10))
img_rgb = np.array(img_ori)
plt.subplot(2, 2, 1), plt.imshow(img_rgb), plt.title('RGB')
plt.subplot(2, 2, 2), plt.imshow(img_rgb[:, :, 0], 'gray'), plt.title('Red')
plt.subplot(2, 2, 3), plt.imshow(img_rgb[:, :, 1], 'gray'), plt.title('Green')
plt.subplot(2, 2, 4), plt.imshow(img_rgb[:, :, 2], 'gray'), plt.title('Blue')plt.tight_layout()
plt.show()# Show HSI channels
plt.figure(figsize=(15, 5))
img_hsi = cv2.cvtColor(np.array(img_ori), cv2.COLOR_RGB2HSV)
img_hsi = np.array(img_hsi)
plt.subplot(1, 3, 1), plt.imshow(img_hsi[:, :, 0], 'gray'), plt.title('Hue')
plt.subplot(1, 3, 2), plt.imshow(img_hsi[:, :, 1], 'gray'), plt.title('Saturation')
plt.subplot(1, 3, 3), plt.imshow(img_hsi[:, :, 2], 'gray'), plt.title('Intensity')plt.tight_layout()
plt.show()

在這里插入圖片描述在這里插入圖片描述

# 圖像平滑
mean_kernal = np.ones([5, 5])
mean_kernal = mean_kernal / (mean_kernal.size)img_rgb_new = np.zeros(img_rgb.shape, np.uint8)for i in range(3):img_temp = img_rgb[:, :, i]img_dst = arithmentic_mean(img_temp, kernel=mean_kernal)img_rgb_new[:, :, i] = img_dstimg_hsi_new = np.zeros(img_rgb.shape, np.uint8)for i in range(3):if i == 2:img_temp = img_hsi[:, :, i]img_dst = arithmentic_mean(img_temp, kernel=mean_kernal)img_hsi_new[:, :, i] = img_dstelse:img_hsi_new[:, :, i] = img_hsi[:, :, i]img_hsi_rgb = cv2.cvtColor(img_hsi_new, cv2.COLOR_HSV2RGB)img_diff = img_rgb_new - img_hsi_rgbplt.figure(figsize=(15, 5))
plt.subplot(1, 3, 1), plt.imshow(img_rgb_new), plt.title('RGB')
plt.subplot(1, 3, 2), plt.imshow(img_hsi_rgb), plt.title('HSI RGB')
plt.subplot(1, 3, 3), plt.imshow(img_diff), plt.title('Differenc')plt.tight_layout()
plt.show()

在這里插入圖片描述

def laplacian_img(img_gray):# 拉普拉期算子,用于邊緣檢對于檢測圖像中的模糊也非常有用kernel_laplacian = np.array(([0,1,0],[1,-4,1],[0,1,0]), np.int8)imgkernel_laplacian = cv2.filter2D(img_gray, -1, kernel_laplacian)laplacian_img = np.uint8(normalize(img_gray + imgkernel_laplacian) * 255)return laplacian_img
# 圖像銳化
img_rgb_new = np.zeros(img_rgb.shape, np.uint8)for i in range(3):img_temp = img_rgb[:, :, i]img_dst = laplacian_img(img_temp)img_rgb_new[:, :, i] = img_dstimg_hsi_new = np.zeros(img_rgb.shape, np.uint8)for i in range(3):if i == 2:img_temp = img_hsi[:, :, i]img_dst = laplacian_img(img_temp)img_hsi_new[:, :, i] = img_dstelse:img_hsi_new[:, :, i] = img_hsi[:, :, i]img_hsi_rgb = cv2.cvtColor(img_hsi_new, cv2.COLOR_HSV2RGB)img_diff = img_rgb_new - img_hsi_rgbplt.figure(figsize=(15, 5))
plt.subplot(1, 3, 1), plt.imshow(img_rgb_new), plt.title('RGB')
plt.subplot(1, 3, 2), plt.imshow(img_hsi_rgb), plt.title('HSI RGB')
plt.subplot(1, 3, 3), plt.imshow(img_diff), plt.title('Differenc')plt.tight_layout()
plt.show()

在這里插入圖片描述

使用彩色分割圖像

HSI 彩色空間中的分割

# HSI彩色圖像分割img_ori = cv2.imread('DIP_Figures/DIP3E_Original_Images_CH06/Fig0642(a)(jupiter_moon_original).tif')
img_ori = img_ori[:, :, ::-1] # BGR 2 RGB# Show HSI channels
plt.figure(figsize=(14, 20))
img_hsi = cv2.cvtColor(np.array(img_ori), cv2.COLOR_RGB2HSV)plt.subplot(4, 2, 1), plt.imshow(img_ori), plt.title('Ori')
plt.subplot(4, 2, 2), plt.imshow(img_hsi[:, :, 0], 'gray'), plt.title('Hue')
plt.subplot(4, 2, 3), plt.imshow(img_hsi[:, :, 1], 'gray'), plt.title('Saturation')
plt.subplot(4, 2, 4), plt.imshow(img_hsi[:, :, 2], 'gray'), plt.title('Intensity')# Threshold
img_s = normalize(img_hsi[:, :, 1])
thresh = 0.255 #0.255 #img_s.max() * 0.1 + 0.233
print(thresh)img_thresh = img_s.copy()
img_thresh = np.where(img_thresh <= thresh, img_thresh, 1)
img_thresh = np.where(img_thresh > thresh, img_thresh, 0)
plt.subplot(4, 2, 5), plt.imshow(img_thresh, 'gray'), plt.title('Binary Thred of Saturation')# Threshold X Hue
img_thred_hue = img_hsi[:, :, 0] * img_thresh
plt.subplot(4, 2, 6), plt.imshow(img_thred_hue, 'gray'), plt.title('Hue X Binary Thred')# Histogram
plt.subplot(4, 2, 7), plt.hist(img_thred_hue.flatten(), bins=256), plt.title('Hue X Binary Thred')# Binary
img_binary = img_thred_hue.copy()
img_binary = np.where(img_binary <= 125, img_binary, 255) # >125 為1
img_binary = np.where(img_binary > 125, img_binary, 0)  # < 125為0
plt.subplot(4, 2, 8), plt.imshow(img_binary, 'gray'), plt.title('Binary')plt.tight_layout()
plt.show()
0.255

在這里插入圖片描述

RGB空間中的分割

  1. 歐氏距離
  2. 協方差矩陣
  3. 邊界盒
def rgb_segment(img_rgb, img_roi, d0):"""RGB spatial domain sementation base of ROIparam: img_rgb: input image, RGB channelparam: img_roi: region of interesting of the image where you want to be seperatedparam: d0: the Euculidean distance of the ROI region against othersreturn: img_dst, a mask image range [0, 1]    """mean = np.mean(img_roi, axis=(0, 1))sigma = np.std(img_roi, axis=(0, 1))img_dst = np.zeros(img_rgb.shape[:2])height, width = img_dst.shapefor h in range(height):for w in range(width):temp = img_rgb[h, w]if np.linalg.norm(temp - mean) <= d0:img_dst[h, w] = 1else:img_dst[h, w] = 0return img_dst
# RGB彩色圖像分割img_ori = cv2.imread('DIP_Figures/DIP3E_Original_Images_CH06/Fig0642(a)(jupiter_moon_original).tif')
# img_ori = img_ori[:, :, ::-1] # BGR 2 RGB
img_rgb = cv2.cvtColor(img_ori, cv2.COLOR_BGR2RGB)plt.figure(figsize=(14, 20))
plt.subplot(4, 2, 1), plt.imshow(img_rgb), plt.title('Ori')# draw rectangle
# img_rect = cv2.rectangle(img_rgb, (60, 240), (98, 315), (255, 255, 255), 2)
# plt.subplot(4, 2, 2), plt.imshow(img_rect), plt.title('ROI')# show ROI
roi = img_rgb[240:315, 60:98, :]
mean = np.mean(roi, axis=(0, 1))
sigma = np.std(roi, axis=(0, 1))
print(f"RGB mean -> {mean}")
print(f"RGB sigma  -> {sigma}")
plt.subplot(4, 2, 3), plt.imshow(roi), plt.title('ROI')img_dst = rgb_segment(img_rgb, roi, d0=38)plt.subplot(4, 2, 4), plt.imshow(img_dst, 'gray'), plt.title('Segment')plt.tight_layout()
plt.show()   
RGB mean -> [146.81298246  40.47473684  42.62385965]
RGB sigma  -> [23.60878011 25.67369246 17.97835714]

在這里插入圖片描述

彩色邊緣檢測

img1_r = cv2.imread('DIP_Figures/DIP3E_Original_Images_CH06/Fig0645(a)(RGB1-red).tif', -1)
img1_g = cv2.imread('DIP_Figures/DIP3E_Original_Images_CH06/Fig0645(b)(RGB1-green).tif', -1)
img1_b = cv2.imread('DIP_Figures/DIP3E_Original_Images_CH06/Fig0645(c)(RGB1-blue).tif', -1)img1_rgb = np.dstack((img1_r, img1_g, img1_b))img2_r = cv2.imread('DIP_Figures/DIP3E_Original_Images_CH06/Fig0645(e)(RGB2_red).tif', -1)
img2_g = cv2.imread('DIP_Figures/DIP3E_Original_Images_CH06/Fig0645(f)(RGB2_green).tif', -1)
img2_b = cv2.imread('DIP_Figures/DIP3E_Original_Images_CH06/Fig0645(g)(RGB2_blue).tif', -1)img2_rgb = np.dstack((img2_r, img2_g, img2_b))plt.figure(figsize=(20, 10))plt.subplot(2, 4, 1), plt.imshow(img1_r, 'gray'), plt.title('R channel'), plt.xticks([]), plt.yticks([])
plt.subplot(2, 4, 2), plt.imshow(img1_g, 'gray'), plt.title('G channel'), plt.xticks([]), plt.yticks([])
plt.subplot(2, 4, 3), plt.imshow(img1_b, 'gray'), plt.title('B channel'), plt.xticks([]), plt.yticks([])
plt.subplot(2, 4, 4), plt.imshow(img1_rgb), plt.title('RGB'), plt.xticks([]), plt.yticks([])plt.subplot(2, 4, 5), plt.imshow(img2_r, 'gray'), plt.title('R channel'), plt.xticks([]), plt.yticks([])
plt.subplot(2, 4, 6), plt.imshow(img2_g, 'gray'), plt.title('G channel'), plt.xticks([]), plt.yticks([])
plt.subplot(2, 4, 7), plt.imshow(img2_b, 'gray'), plt.title('B channel'), plt.xticks([]), plt.yticks([])
plt.subplot(2, 4, 8), plt.imshow(img2_rgb), plt.title('RGB'), plt.xticks([]), plt.yticks([])plt.tight_layout()
plt.show()   

在這里插入圖片描述

彩色圖像中的噪聲

# RGB channel merge to RGB image
img1_r = cv2.imread('DIP_Figures/DIP3E_Original_Images_CH06/Fig0648(a)(lenna-noise-R-gauss-mean0-var800).tif', 0)
img1_g = cv2.imread('DIP_Figures/DIP3E_Original_Images_CH06/Fig0648(b)(lenna-noise-G-gauss-mean0-var800).tif', 0)
img1_b = cv2.imread('DIP_Figures/DIP3E_Original_Images_CH06/Fig0648(c)(lenna-noise-B-gauss-mean0-var800).tif', 0)
img1_rgb = np.dstack((img1_r, img1_g, img1_b))plt.figure(figsize=(10, 10))plt.subplot(2, 2, 1), plt.imshow(img1_r, 'gray'), plt.title('R channel'), plt.xticks([]), plt.yticks([])
plt.subplot(2, 2, 2), plt.imshow(img1_g, 'gray'), plt.title('G channel'), plt.xticks([]), plt.yticks([])
plt.subplot(2, 2, 3), plt.imshow(img1_b, 'gray'), plt.title('B channel'), plt.xticks([]), plt.yticks([])
plt.subplot(2, 2, 4), plt.imshow(img1_rgb), plt.title('RGB'), plt.xticks([]), plt.yticks([])plt.tight_layout()
plt.show()   

在這里插入圖片描述

# convert RGB to HSI, noise affect all channels
img1_hsi = cv2.cvtColor(img1_rgb, cv2.COLOR_RGB2HSV_FULL)plt.figure(figsize=(15, 5))plt.subplot(1, 3, 1), plt.imshow(img1_hsi[:, :, 0], 'gray'), plt.title('Hue'), plt.xticks([]), plt.yticks([])
plt.subplot(1, 3, 2), plt.imshow(img1_hsi[:, :, 1], 'gray'), plt.title('Saturation'), plt.xticks([]), plt.yticks([])
plt.subplot(1, 3, 3), plt.imshow(img1_hsi[:, :, 2], 'gray'), plt.title('Intensity'), plt.xticks([]), plt.yticks([])plt.tight_layout()
plt.show()   

在這里插入圖片描述

# RGB image, only green channel affect noise, but convert to HSI, all channel affect
img1_ori = cv2.imread('DIP_Figures/DIP3E_Original_Images_CH06/Fig0650(a)(rgb_image_G_saltpep_pt05).tif')
img1_rgb = img1_ori[:, :, ::-1]plt.figure(figsize=(20, 10))img1_hsi = cv2.cvtColor(img1_rgb, cv2.COLOR_RGB2HSV_FULL)plt.subplot(2, 4, 1), plt.imshow(img1_rgb), plt.title('RGB'), plt.xticks([]), plt.yticks([])
plt.subplot(2, 4, 2), plt.imshow(img1_hsi[:, :, 0], 'gray'), plt.title('Hue'), plt.xticks([]), plt.yticks([])
plt.subplot(2, 4, 3), plt.imshow(img1_hsi[:, :, 1], 'gray'), plt.title('Saturation'), plt.xticks([]), plt.yticks([])
plt.subplot(2, 4, 4), plt.imshow(img1_hsi[:, :, 2], 'gray'), plt.title('Intensity'), plt.xticks([]), plt.yticks([])plt.subplot(2, 4, 5), plt.imshow(img1_rgb[:, :, 0], 'gray'), plt.title('R channel'), plt.xticks([]), plt.yticks([])
plt.subplot(2, 4, 6), plt.imshow(img1_rgb[:, :, 1], 'gray'), plt.title('G channel'), plt.xticks([]), plt.yticks([])
plt.subplot(2, 4, 7), plt.imshow(img1_rgb[:, :, 2], 'gray'), plt.title('B channel'), plt.xticks([]), plt.yticks([])plt.tight_layout()
plt.show()   

在這里插入圖片描述

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/260534.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/260534.shtml
英文地址,請注明出處:http://en.pswp.cn/news/260534.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

javascript 在對象中使用 定時器_如何使用JavaScript 面向對象編程

學習目標理解面向對象開發思想掌握 JavaScript 面向對象開發相關模式面向對象介紹什么是對象Everything is object (一切皆對象)我們可以從兩個層次來理解對象&#xff1a;(1) 對象是單個事物的抽象。一本書、一輛汽車、一個人都可以是對象&#xff0c;一個數據庫、一張網頁、一…

char數組轉string_String類和其它數據類型的相互轉換

對于上面的這些包裝類&#xff0c;除了Character以外&#xff0c;都有可以直接使用字符串參數的構造函數&#xff0c;這也就使得我們將String類轉換為這些數據類型變得相當之簡單&#xff0c;即&#xff1a;Boolean(String s)、Integer(String s)、Long(String s)、Float(Strin…

ORACLE 各種閃回操作

1、Flashback Database&#xff08;利用閃回日志恢復&#xff09; Oracle Flashback Database特性允許通過SQL語句Flashback Database語句&#xff0c;讓數據庫前滾到當前的前一個時間點或者SCN&#xff0c;而不需要做時間點的恢復。閃回數據庫可以迅速將數據庫回到誤操作或人為…

【轉】介紹設置Session失效的幾種方法

轉載地址&#xff1a;http://developer.51cto.com/art/201106/269493.htm Session對象是HttpSessionState的一個實例。該類為當前用戶會話提供信息&#xff0c;還提供對可用于存儲信息會話范圍的緩存的訪問&#xff0c;以及控制如何管理會話的方法。下面介紹設置session失效的幾…

mysql導入數據load data infile用法整理

有時候我們需要將大量數據批量寫入數據庫&#xff0c;直接使用程序語言和Sql寫入往往很耗時間&#xff0c;其中有一種方案就是使用MySql Load data infile導入文件的形式導入數據&#xff0c;這樣可大大縮短數據導入時間。 假如是從MySql客戶端調用&#xff0c;將客戶端的文件導…

python3循環一直到一個值結束_一步一步學Python3(小學生也適用) 第十七篇:循環語句for in循環...

一、Python for in循環Python for in 循環&#xff0c;是用來遍歷任何數據序列&#xff0c;如一個列表&#xff0c;一個字符串&#xff0c;一個字典&#xff0c;一個元組等。for in 循環的一般語法如下&#xff1a;for item in 序列:語句塊else:語句塊for in 字符串&#xff1…

設置Jupyter notebook 默認工作路徑,修改Jupyter notebook 默認瀏覽器為Chrome

這里寫目錄標題一 設置Jupyter notebook 默認工作路徑二 修改Jupyter notebook 默認瀏覽器為Chrome一 設置Jupyter notebook 默認工作路徑 安裝好anaconda 后&#xff0c;jupyter notebook默認是有安裝好的。在windows的菜單欄找到anaconda目錄&#xff0c;如下圖 鼠標右鍵點…

python調用c#注意事項_Python調用C#編寫的DLL

起因是工作中需要用的開發編寫的DLL&#xff0c;但是它是使用C#編寫的&#xff0c;本人不想使用C#去寫測試代碼&#xff0c;所以需要使用Python來掉這個DLL內的方法 就用這個就很好&#xff0c;不要問為啥不用微軟的Ironpython和別的啥&#xff0c;好用就行了&#xff0c;解決問…

jquery實戰--定寬

大家有沒有遇到過一個問題&#xff0c;就是一個列表&#xff0c;或是一段文字過多時&#xff0c;截取多余的部分用省略號&#xff0c;好吧&#xff0c;證明你實力的時候到了&#xff0c;我下面先分解一下方法&#xff0c;再用插件寫出來,首先我們說的是&#xff0c;用到的第一個…

struts2 Action獲取表單數據

1.通過屬性驅動式 1.首先設置 表單中的數據的name值 如&#xff1a;<input type"text" name"username" value""> 2.你用的是struts2&#xff0c;那么就在java類中寫一個變量&#xff1a;變量名和頁面上的name值一致 并有這個變量的get 和…

python 計算器 eval ctf_CTF逆向--.NET與Python篇

題目(來源&#xff1a;Jarvis-OJ)&#xff1a;Classical CrackmeClassical CrackMe2FindKeyLoginClassical Crackme首先查殼沒有殼&#xff0c;不過發現這是一個.net的程序&#xff0c;將其拖進dnSpy中&#xff0c;找到主程序&#xff0c;同時發現關鍵代碼&#xff0c;如下所示…

2016年秋季個人閱讀計劃

閱讀書目&#xff1a;《軟件需求十步走》 讀后感發表日期&#xff1a;閱讀書目&#xff1a;《用戶故事與敏捷方法》 讀后感發表日期&#xff1a;第一篇&#xff1a;10月1日 第二篇&#xff1a;10月3日 第三篇&#xff1a;10月7日 第四篇&#xff1a;10月15日 第五篇&#xff1a…

第10章 Python 數字圖像處理(DIP) - 圖像分割 基礎知識 標準差分割法

This Chapter is all about image segmentation. I still not finished whole chapter, but here try to publish some for reference. 這里寫目錄標題基礎知識import sys import numpy as np import cv2 import matplotlib import matplotlib.pyplot as plt import PIL from …

OFBiz的探索進階

主要參照https://cwiki.apache.org/OFBIZ/ofbiz-tutorial-a-beginners-development-guide.html這個教程&#xff0c;實現的過程教程上很詳細&#xff0c;故這里不多說 還參考了下http://www.hotwaxmedia.com/apache-ofbiz-blog/ofbiz/ofbiz-tutorials/ofbiz-tutorial-building-…

python3語法都相同嗎_python2 與 python3 語法區別--轉

原文地址&#xff1a;http://old.sebug.net/paper/books/dive-into-python3/porting-code-to-python-3-with-2to3.html 使用2to3將代碼移植到Python 3 ? Life is pleasant. Death is peaceful. It’s the transition that’s troublesome. ? — Isaac Asimov (attributed) 概…

對GCD的一些理解和實踐

對GCD的一些理解和實踐GCD GCD&#xff0c;全程Grand Central Dispatch&#xff0c;是蘋果為了多核并行提出的解決方案。它是使用C語言實現&#xff0c;但是由于用了block來處理回調&#xff0c;所以使用起來十分方便。并且GCD會自動管理線程的生命周期&#xff0c;不需要我們去…

python scrapy爬蟲遇見301_在Pycharm中運行Scrapy爬蟲項目的基本操作

目標在Win7上建立一個Scrapy爬蟲項目&#xff0c;以及對其進行基本操作。運行環境&#xff1a;電腦上已經安裝了python(環境變量path已經設置好)&#xff0c;以及scrapy模塊&#xff0c;IDE為Pycharm 。操作如下&#xff1a;一、建立Scrapy模板。進入自己的工作目錄&#xff0c…

[Buzz Today]2012.08.08

# Dark Reign 2 源代碼現身Google Code Pandemic工作室開發的即時戰略游戲《Dark Reign 2》源代碼被泄露到了Google Code http://code.google.com/p/darkreign2/ # Warsow 1.0發布 Set in a futuristic cartoonish world, Warsow is a completely free fast-paced first-person…

PyTorch訓練中Dataset多線程加載數據,比Dataloader里設置多個workers還要快

PyTorch訓練中Dataset多線程加載數據&#xff0c;而不是在DataLoader 背景與需求 現在做深度學習的越來越多人都有用PyTorch&#xff0c;他容易上手&#xff0c;而且API相對TF友好的不要太多。今天就給大家帶來最近PyTorch訓練的一些小小的心得。 大家做機器學習、深度學習都…

Trading

http://v.youku.com/v_show/id_XMTA0OTcxMjgw.html?fromy1.2-1-87.3.8-1.1-1-1-7 轉載于:https://www.cnblogs.com/wangjianping/p/3705524.html