PlantCV更新

PyPI

通过终端升级PlantCV:

pip install --upgrade

Conda

通过终端升级PlantCV:

conda upgrade -n plantcv plantcv

如果conda无法更新PlantCV,请尝试安装特定版本。例如,如果你的版本是v3.6.1,而你想要安装v3.6.2,你可以使用以下代码:

conda install -n plantcv plantcv=3.6.2

你可以通过bioconda查看最新的可用版本:

conda list plantcv

手动安装

如果你使用的是danforthcenter/plantcv代码库克隆的master 分支,常规升级步骤是更新本地库并重新安装包。

如果不确定是否从danforthcenter/plantcv代码库克隆的master 分支,可以尝试以下代码:

cd plantcv

git remote -v

# 你会看到如下内容:
# origin    https://github.com/danforthcenter/plantcv.git (fetch)

git status

# 你会看到如下内容:
# On branch master
# nothing to commit, working directory clean

如果以上内容正确显示,就可以通过下面的操作更新:

git pull

python setup.py install

# 如果需要权限请加sudo

如果你应将克隆后的plantcv库文件夹添加到你的PYTHONPATH那么只需要拉取操作就可以升级。具体依赖项详见以下安装说明。当使用PlantCV克隆时(而不是conda环境),更新可能需要在克隆完成后手动添加依赖项。

从 v1 版升级到 v2 版

安装工具方法在PlantCV v1中并不适用,所以用户需要将plantcv/lib路径添加到自定义的PYTHONPATH。在PlantCV v2中,plantcv library路径在lib中已经不存在,而是在库的main文件夹 (plantcv/plantcv)。如果你想要继续将plantcv添加到PYTHONPATH,你需要将‘lib’从路径中移除来进行更新。也可以在拉取新版本后移除lib文件夹。Git会自动移除 *.py ,但由于并不查询,*.pyc文件依旧会保留并且可以导入,会引起混乱。

针对 Linux/Unix, PYTHONPATH 可以编辑为 ~/.bash_profile, ~/.bashrc, ~/.profile, ~/.cshrc, ~/.zshrc, 等。

针对 Windows, 右键我的电脑或者此电脑,选择属性>高级系统设置>环境变量,编辑用户变量添加 PYTHONPATH

同时要注意PlantCV并行方法也发生了改变,请查阅最新的 并行处理文档

升级到 v3版

PlantCV v3新增功能的主要目标是使PlantCV更容易使用。我们希望您接受以下变更,如果您有任何疑问或者顾虑请随时在GitHub开一个讨论话题或者直接联系我们。

为了支持可选安装附属包,我们将PlantCV转换为 namespace package。为了实现新功能,已有函数已经移动到附属包中来保持导入。为了维持之前的操作,PlantCV 分析脚本只需要修改一下PlantCV导入句式。所以如果你之前操作如下:

import plantcv as pcv

那么之后的操作:

from plantcv import plantcv as pcv

PlantCV v3另外一个推出的功能是升级现有包的API。这是为了通过减少导入导出需要的设置(在不减少功能的情况下),让导入参数命名更加一致并且明确定义输入输出类型(例如,不再使用img,而对RGB、灰度或黑白图像分别使用 rgb_img, gray_img, 或 bin_img),让每个PlantCV函数更佳容易使用。

在PlantCV v3.0dev2以后的版本中,所有的函数已经重新设计可以利用全局变量等级来承接标准导入数值例如 debugdevice,从而这些值不需要再额外从其他函数导入导出。一个案例class Params ,由于params在PlantCV导入后已经自动生成,可以导入来设置全局默认值。例如,如果需要改变debug从None到'plot' 或 'print',你现在只需要在代码或notebook最上方增加一行来改变所有下方函数的调用:

from plantcv import plantcv as pcv
pcv.params.debug = "plot"

因此,所有函数调用需要更新来移除 device输入和输出变量以及debug输入变量。例如:

from plantcv import plantcv as pcv
pcv.params.debug = "plot"

img, img_path, img_filename = pcv.readimage("image.png")

gray_img = pcv.rgb2gray_hsv(img, "s")

bin_img = pcv.threshold.binary(gray_img, 100, 255)

更多信息详见 Params 文档。

以下是所有从v3.0dev2之前版本到v3.0dev2之后版本函数调用的变更,以及v3.0发行版的升级。可以通过查看每个函数的帮助叶面来获取更多输入输出变量类型信息。

plantcv.acute

  • v3.0dev2之前: device, homolog_pts, start_pts, stop_pts, ptvals, chain, max_dist = plantcv.acute(obj, win, thresh, mask, device, debug=None)
  • v3.0dev2之后: homolog_pts, start_pts, stop_pts, ptvals, chain, max_dist = plantcv.acute(obj, win, thresh, mask)
  • v3.2之后: homolog_pts, start_pts, stop_pts, ptvals, chain, max_dist = plantcv.acute(obj, mask, win, thresh)

plantcv.acute_vertex

  • v3.0dev2之前: device, acute = plantcv.acute_vertex(obj, win, thresh, sep, img, device, debug=None)
  • v3.0dev2之后: acute = plantcv.acute_vertex(obj, win, thresh, sep, img)
  • v3.2之后: acute, analysis_image = plantcv.acute_vertex(img, obj, win, thresh, sep)

plantcv.adaptive_threshold

  • v3.0dev2之前: device, bin_img = plantcv.adaptive_threshold(img, maxValue, thres_type, object_type, device, debug=None)
  • v3.0dev2之后: Deprecated, see:
    • bin_img = plantcv.threshold.gaussian(gray_img, max_value, object_type="light")
    • bin_img = plantcv.threshold.mean(gray_img, max_value, object_type="light")

plantcv.analyze_bound

  • v3.0dev2之前: device, bound_header, bound_data, analysis_images = plantcv.analyze_bound(img, imgname, obj, mask, line_position, device, debug=None, filename=False)
  • v3.0dev2之后: Deprecated, see:
    • analysis_images = plantcv.analyze_bound_horizontal(img, obj, mask, line_position, filename=False)

plantcv.analyze_bound_horizontal

  • v3.0dev2之前: device, bound_header, bound_data, analysis_images = plantcv.analyze_bound_horizontal(img, obj, mask, line_position, device, debug=None, filename=False)
  • v3.0dev2之后: bound_header, bound_data, analysis_images = plantcv.analyze_bound_horizontal(img, obj, mask, line_position, filename=False)
  • v3.0之后: bound_header, bound_data, analysis_images = plantcv.analyze_bound_horizontal(img, obj, mask, line_position)
  • v3.3之后: analysis_image = plantcv.analyze_bound_horizontal(img, obj, mask, line_position)

plantcv.analyze_bound_vertical

  • v3.0dev2之前: device, bound_header, bound_data, analysis_images = plantcv.analyze_bound_vertical(img, obj, mask, line_position, device, debug=None, filename=False)
  • v3.0dev2之后: bound_header, bound_data, analysis_images = plantcv.analyze_bound_vertical(img, obj, mask, line_position, filename=False)
  • v3.0.5之后: bound_header, bound_data, analysis_images = plantcv.analyze_bound_vertical(img, obj, mask, line_position)
  • v3.3之后: analysis_image = plantcv.analyze_bound_vertical(img, obj, mask, line_position)

plantcv.analyze_color

  • v3.0dev2之前: device, hist_header, hist_data, analysis_images = plantcv.analyze_color(img, imgname, mask, bins, device, debug=None, hist_plot_type=None, pseudo_channel='v', pseudo_bkg='img', resolution=300, filename=False)
  • v3.0dev2之后: hist_header, hist_data, analysis_images = plantcv.analyze_color(rgb_img, mask, bins, hist_plot_type=None, pseudo_channel='v', pseudo_bkg='img', filename=False)
  • v3.0之后: hist_header, hist_data, analysis_images = plantcv.analyze_color(rgb_img, mask, bins, hist_plot_type=None)
  • v3.3之后: analysis_image = plantcv.analyze_color(rgb_img, mask, hist_plot_type=None)

plantcv.analyze_nir_intensity

  • v3.0dev2之前: device, hist_header, hist_data, analysis_img = plantcv.analyze_NIR_intensity(img, rgbimg, mask, bins, device, histplot=False, debug=None, filename=False)
  • v3.0dev2之后: hist_header, hist_data, analysis_img = plantcv.analyze_nir_intensity(gray_img, mask, bins, histplot=False, filename=False)
  • v3.0之后: hist_header, hist_data, nir_hist = plantcv.analyze_nir_intensity(gray_img, mask, bins, histplot=False)
  • v3.3之后: nir_hist = plantcv.analyze_nir_intensity(gray_img, mask, bins, histplot=False)

plantcv.analyze_object

  • v3.0dev2之前: device, shape_header, shape_data, analysis_images = plantcv.analyze_object(img, imgname, obj, mask, device, debug=None, filename=False)
  • v3.0dev2之后: shape_header, shape_data, analysis_images = plantcv.analyze_object(img, obj, mask, filename=False)
  • v3.0之后: shape_header, shape_data, analysis_images = plantcv.analyze_object(img, obj, mask)
  • v3.3之后: analysis_image = plantcv.analyze_object(img, obj, mask)

plantcv.analyze_thermal_values

  • v3.5之前: NA
  • v3.5之后: thermal_histogram = plantcv.analyze_thermal_values(thermal_array, mask, histplot=False)

plantcv.apply_mask

  • v3.0dev2之前: device, masked_img = plantcv.apply_mask(img, mask, mask_color, device, debug=None)
  • v3.0dev2之后: masked_img = plantcv.apply_mask(rgb_img, mask, mask_color)
  • v3.7之后: masked_img = plantcv.apply_mask(img, mask, mask_color)

plantcv.auto_crop

  • v3.0dev2之前: device, cropped = plantcv.auto_crop(device, img, objects, padding_x=0, padding_y=0, color='black', debug=None)
  • v3.0dev2之后: cropped = plantcv.auto_crop(img, objects, padding_x=0, padding_y=0, color='black')
  • v3.2之后: cropped = plantcv.auto_crop(img, obj, padding_x=0, padding_y=0, color='black')

plantcv.background_subtraction

  • v3.0dev2之前: device, fgmask = plantcv.background_subtraction(background_image, foreground_image, device, debug=None)
  • v3.0dev2之后: fgmask = plantcv.background_subtraction(background_image, foreground_image)

plantcv.binary_threshold

  • v3.0dev2之前: device, bin_img = plantcv.binary_threshold(img, threshold, maxValue, object_type, device, debug=None)
  • v3.0dev2之后: Deprecated, see:
    • bin_img = plantcv.threshold.binary(gray_img, threshold, max_value, object_type="light")

plantcv.canny_edge_detect

  • v3.2之前: NA
  • v3.2之后: bin_img = plantcv.canny_edge_detect(img, mask=None, sigma=1.0, low_thresh=None, high_thresh=None, thickness=1, mask_color=None, use_quantiles=False)

plantcv.closing

  • v3.3之前: NA
  • v3.3之后: filtered_img = plantcv.closing(gray_img, kernel=None)

plantcv.cluster_contour_splitimg

  • v3.0dev2之前: device, output_path = plantcv.cluster_contour_splitimg(device, img, grouped_contour_indexes, contours, hierarchy, outdir=None, file=None, filenames=None, debug=None)
  • v3.0dev2之后: output_path = plantcv.cluster_contour_splitimg(rgb_img, grouped_contour_indexes, contours, hierarchy, outdir=None, file=None, filenames=None)
  • v3.3之后: output_path, output_imgs, output_masks = plantcv.cluster_contour_splitimg(rgb_img, grouped_contour_indexes, contours, hierarchy, outdir=None, file=None, filenames=None)

plantcv.cluster_contours

  • v3.0dev2之前: device, grouped_contour_indexes, contours, roi_obj_hierarchy = plantcv.cluster_contours(device, img, roi_objects,roi_obj_hierarchy, nrow=1, ncol=1, debug=None)
  • v3.0dev2之后: grouped_contour_indexes, contours, roi_obj_hierarchy = plantcv.cluster_contours(img, roi_objects, roi_obj_hierarchy, nrow=1, ncol=1)
  • v3.2之后: grouped_contour_indexes, contours, roi_obj_hierarchy = plantcv.cluster_contours(img, roi_objects, roi_object_hierarchy, nrow=1, ncol=1, show_grid=False)

plantcv.color_palette

  • v3.0之前: NA
  • v3.0之后: colors = plantcv.color_palette(num)

plantcv.crop_position_mask

  • v3.0dev2之前: device, newmask = plantcv.crop_position_mask(img, mask, device, x, y, v_pos="top", h_pos="right", debug=None)
  • v3.0dev2之后: newmask = plantcv.crop_position_mask(img, mask, x, y, v_pos="top", h_pos="right")

plantcv.define_roi

  • v3.0dev2之前: device, contour, hierarchy = plantcv.define_roi(img, shape, device, roi=None, roi_input='default', debug=None, adjust=False, x_adj=0, y_adj=0, w_adj=0, h_adj=0)
  • v3.0dev2之后: Deprecated, see:
    • roi_contour, roi_hierarchy = plantcv.roi.circle(img, x, y, r)
    • roi_contour, roi_hierarchy = plantcv.roi.ellipse(img, x, y, r1, r2, angle)
    • roi_contour, roi_hierarchy = plantcv.roi.from_binary_image(img, bin_img)
    • roi_contour, roi_hierarchy = plantcv.roi.rectangle(img, x, y, h, w)

plantcv.dilate

  • v3.0dev2之前: device, dil_img = plantcv.dilate(img, kernel, i, device, debug=None)
  • v3.0dev2之后: dil_img = plantcv.dilate(gray_img, kernel, i)
  • v3.2之后: dil_img = plantcv.dilate(gray_img, ksize, i)

plantcv.distance_transform

  • v3.0dev2之前: device, norm_image = plantcv.distance_transform(img, distanceType, maskSize, device, debug=None)
  • v3.0dev2之后: norm_image = plantcv.distance_transform(bin_img, distance_type, mask_size)

plantcv.erode

  • v3.0dev2之前: device, er_img = plantcv.erode(img, kernel, i, device, debug=None)
  • v3.0dev2之后: er_img = plantcv.erode(gray_img, kernel, i)
  • v3.2之后: er_img = plantcv.erode(gray_img, ksize, i)

plantcv.fill

  • v3.0dev2之前: device, filtered_img = plantcv.fill(img, mask, size, device, debug=None)
  • v3.0dev2之后: filtered_img = plantcv.fill(bin_img, size)

plantcv.fill_holes

  • v3.3之前: NA
  • v3.3之后: filtered_img = plantcv.fill(bin_img)

plantcv.find_objects

  • v3.0dev2之前: device, objects, hierarchy = plantcv.find_objects(img, mask, device, debug=None)
  • v3.0dev2之后: objects, hierarchy = plantcv.find_objects(img, mask)

plantcv.flip

  • v3.0dev2之前: device, vh_img = plantcv.flip(img, direction, device, debug=None)
  • v3.0dev2之后: vh_img = plantcv.flip(img, direction)

plantcv.fluor_fvfm

  • v3.0dev2之前: device, hist_header, hist_data = plantcv.fluor_fvfm(fdark, fmin, fmax, mask, device, filename, bins=1000, debug=None)
  • v3.0dev2之后: hist_header, hist_data, hist_images = plantcv.fluor_fvfm(fdark, fmin, fmax, mask, filename, bins=256)
  • v3.0之后: hist_header, hist_data, analysis_images = plantcv.fluor_fvfm(fdark, fmin, fmax, mask, bins=256)
  • v3.3之后: analysis_images = plantcv.fluor_fvfm(fdark, fmin, fmax, mask, bins=256)

plantcv.gaussian_blur

  • v3.0dev2之前: device, img_gblur = plantcv.gaussian_blur(device, img, ksize, sigmax=0, sigmay=None, debug=None)
  • v3.0dev2之后: img_gblur = plantcv.gaussian_blur(img, ksize, sigmax=0, sigmay=None)
  • v3.2之后: img_gblur = plantcv.gaussian_blur(img, ksize, sigma_x=0, sigma_y=None)

plantcv.get_nir

  • v3.0dev2之前: device, nirpath = plantcv.get_nir(path, filename, device, debug=None)
  • v3.0dev2之后: nirpath = plantcv.get_nir(path, filename)

plantcv.hist_equalization

  • v3.0dev2之前: device, img_eh = plantcv.hist_equalization(img, device, debug=None)
  • v3.0dev2之后: img_eh = plantcv.hist_equalization(gray_img)

plantcv.hyperspectral.analyze_index

  • v3.7之前: NA
  • v3.7之后: plantcv.hyperspectral.analyze_index(index_array, mask)
  • v3.8之后: index_histogram = plantcv.hyperspectral.analyze_index(index_array, mask, histplot=False, bins=100, max_bin=0, min_bin=1)

plantcv.hyperspectral.analyze_spectral

  • v3.7之前: NA
  • v3.7之后: spectral_histogram = plantcv.hyperspectral.analyze_spectral(array, mask, histplot=True)

plantcv.hyperspectral.extract_index

  • v3.7之前: NA
  • v3.7之后: index_array = plantcv.hyperspectral.extract_index(array, index="NDVI", distance=20)
  • v3.8之后: DEPRECATED see plantcv.spectral_index

plantcv.image_add

  • v3.0dev2之前: device, added_img = plantcv.image_add(img1, img2, device, debug=None)
  • v3.0dev2之后: added_img = plantcv.image_add(gray_img1, gray_img2)

plantcv.image_subtract

  • v3.0之前: NA
  • v3.0之后: new_img = plantcv.image_subtract(gray_img1, gray_img2)

plantcv.invert

  • v3.0dev2之前: device, img_inv = plantcv.invert(img, device, debug=None)
  • v3.0dev2之后: img_inv = plantcv.invert(gray_img)

plantcv.landmark_reference_pt_dist

  • v3.0dev2之前: device, vert_ave_c, hori_ave_c, euc_ave_c, ang_ave_c, vert_ave_b, hori_ave_b, euc_ave_b, ang_ave_b = plantcv.landmark_reference_pt_dist(points_r, centroid_r, bline_r, device, debug=None)
  • v3.0dev2之后: vert_ave_c, hori_ave_c, euc_ave_c, ang_ave_c, vert_ave_b, hori_ave_b, euc_ave_b, ang_ave_b = plantcv.landmark_reference_pt_dist(points_r, centroid_r, bline_r)
  • v3.2之后: landmark_header, landmark_data = plantcv.landmark_reference_pt_dist(points_r, centroid_r, bline_r)
  • v3.3之后: plantcv.landmark_reference_pt_dist(points_r, centroid_r, bline_r)

plantcv.laplace_filter

  • v3.0dev2之前: device, lp_filtered = plantcv.laplace_filter(img, k, scale, device, debug=None)
  • v3.0dev2之后: lp_filtered = plantcv.laplace_filter(gray_img, k, scale)
  • v3.2之后: lp_filtered = plantcv.laplace_filter(gray_img, ksize, scale)

plantcv.logical_and

  • v3.0dev2之前: device, merged = plantcv.logical_and(img1, img2, device, debug=None)
  • v3.0dev2之后: merged = plantcv.logical_and(bin_img1, bin_img2)

plantcv.logical_or

  • v3.0dev2之前: device, merged = plantcv.logical_or(img1, img2, device, debug=None)
  • v3.0dev2之后: merged = plantcv.logical_or(bin_img1, bin_img2)

plantcv.logical_xor

  • v3.0dev2之前: device, merged = plantcv.logical_xor(img1, img2, device, debug=None)
  • v3.0dev2之后: merged = plantcv.logical_xor(bin_img1, bin_img2)

plantcv.median_blur

  • v3.0dev2之前: device, img_mblur = plantcv.median_blur(img, ksize, device, debug=None)
  • v3.0dev2之后: img_mblur = plantcv.median_blur(gray_img, ksize)
  • v3.2之后: img_blur = plantcv.median_blur(gray_img, ksize) OR img_blur = plantcv.median_blur(gray_img, (ksize1, ksize2))

plantcv.morphology.check_cycles

  • v3.3之前: NA
  • v3.3之后: cycle_img = plantcv.morphology.check_cycles(skel_img)

plantcv.morphology.find_branch_pts

  • v3.3之前: NA
  • v3.3之后: branch_pts_img = plantcv.morphology.find_branch_pts(skel_img, mask=None)

plantcv.morphology.find_tips

  • v3.3之前: NA
  • v3.3之后: tip_img = plantcv.morphology.find_tips(skel_img, mask=None)

plantcv.morphology.prune

  • v3.3之前: NA
  • v3.3之后: pruned_img = plantcv.morphology.prune(skel_img, size)
  • v3.4之后: pruned_skeleton, segmented_img, segment_objects = plantcv.morphology.prune(skel_img, size=0, mask=None)

plantcv.morphology.segment_angle

  • v3.3之前: NA
  • v3.3之后: labeled_img = plantcv.morphology.segment_angle(segmented_img, objects)

plantcv.morphology.curvature

  • v3.3之前: NA
  • v3.3之后: labeled_img = plantcv.morphology.segment_curvature(segmented_img, objects)

plantcv.morphology.segment_euclidean_length

  • v3.3之前: NA
  • v3.3之后: labeled_img = plantcv.morphology.segment_euclidean_length(segmented_img, objects)

plantcv.morphology.segment_id

  • v3.3之前: NA
  • v3.3之后: segmented_img, labeled_img = plantcv.morphology.segment_id(skel_img, objects, mask=None)

plantcv.morphology.segment_path_length

  • v3.3之前: NA
  • v3.3之后: labeled_img = plantcv.morphology.segment_path_length(segmented_img, objects)

plantcv.morphology.segment_skeleton

  • v3.3之前: NA
  • v3.3之后: segmented_img, segment_objects = plantcv.morphology.segment_skeleton(skel_img, mask=None)

plantcv.morphology.segment_sort

  • v3.3之前: NA
  • v3.3之后: secondary_objects, primary_objects = plantcv.morphology.segment_sort(skel_img, objects, mask=None)

plantcv.morphology.segment_tangent_angle

  • v3.3之前: NA
  • v3.3之后: labeled_img = plantcv.morphology.segment_tangent_angle(segmented_img, objects, size)

plantcv.morphology.skeletontize

  • v3.3之前: NA
  • v3.3之后: skeleton = plantcv.morphology.skeletonize(mask)

plantcv.naive_bayes_classifier

  • v3.0dev2之前: device, masks = plantcv.naive_bayes_classifier(img, pdf_file, device, debug=None)**
  • v3.0dev2之后: masks = plantcv.naive_bayes_classifier(rgb_img, pdf_file)**

plantcv.object_composition

  • v3.0dev2之前: device, group, mask = plantcv.object_composition(img, contours, hierarchy, device, debug=None)
  • v3.0dev2之后: group, mask = plantcv.object_composition(img, contours, hierarchy)

plantcv.opening

  • v3.3之前: NA
  • v3.3之后: filtered_img = plantcv.opening(gray_img, kernel=None)

plantcv.otsu_auto_threshold

  • v3.0dev2之前: device, bin_img = plantcv.otsu_auto_threshold(img, maxValue, object_type, device, debug=None)
  • v3.0dev2之后: Deprecated, see:
    • bin_img = plantcv.threshold.otsu(gray_img, max_value, object_type="light")

plantcv.output_mask

  • v3.0dev2之前: device, maskpath, analysis_images = plantcv.output_mask(device, img, mask, filename, outdir=None, mask_only=False, debug=None)
  • v3.0dev2之后: imgpath, maskpath, analysis_images = plantcv.output_mask(img, mask, filename, outdir=None, mask_only=False)

plantcv.plot_hist

  • v3.0dev2之前: bins, hist = plantcv.plot_hist(img, name=False)
  • v3.0dev2之后: bins, hist = plantcv.plot_hist(img, name=False)
  • v3.2之后: Deprecated, see:
    • hist_header, hist_data, fig_hist = plantcv.visualize.histogram(gray_img, mask=None, bins=256)

plantcv.plot_image

  • v3.0dev2之前: plantcv.plot_image(img, cmap=None)
  • v3.0dev2之后: plantcv.plot_image(img, cmap=None)

plantcv.print_image

  • v3.0dev2之前: plantcv.print_image(img, filename)
  • v3.0dev2之后: plantcv.print_image(img, filename)

plantcv.print_results

  • v3.1之前: NA
  • v3.1之后: plantcv.print_results(filename)

plantcv.pseudocolor

  • v3.1之前: NA
  • v3.1之后: pseudo_img = plantcv.pseudocolor(gray_img, obj=None, mask=None, cmap=None, background="image", min_value=0, max_value=255, dpi=None, axes=True, colorbar=True)
  • v3.2之后: Deprecated, see:
    • pseudo_img = plantcv.visualize.pseudocolor(gray_img, obj=None, mask=None, cmap=None, background="image", min_value=0, max_value=255, axes=True, colorbar=True)

plantcv.readbayer

  • v3.0之前: NA
  • v3.0之后: img, path, img_name = plantcv.readbayer(filename, bayerpattern = 'BG', alg = 'default')

plantcv.readimage

  • v3.0dev2之前: img, path, img_name = plantcv.readimage(filename, debug=None)
  • v3.0dev2之后: img, path, img_name = plantcv.readimage(filename, mode="native")

plantcv.rectangle_mask

  • v3.0dev2之前: device, img1, bnk, contour, hierarchy = plantcv.rectangle_mask(img, p1, p2, device, debug=None, color="black")
  • v3.0dev2之后: img1, bnk, contour, hierarchy = plantcv.rectangle_mask(img, p1, p2, color="black")

plantcv.report_size_marker_area

  • v3.0dev2之前: device, marker_header, marker_data, analysis_images = plantcv.report_size_marker_area(img, shape, device, debug, marker='define', x_adj=0, y_adj=0, w_adj=0, h_adj=0, base='white', objcolor='dark', thresh_channel=None, thresh=None, filename=False)
  • v3.0dev2之后: marker_header, marker_data, analysis_images = plantcv.report_size_marker_area(img, roi_contour, roi_hierarchy, marker='define', objcolor='dark', thresh_channel=None, thresh=None, filename=False)
  • v3.1之后: marker_header, marker_data, analysis_image = plantcv.report_size_marker_area(img, roi_contour, roi_hierarchy, marker='define', objcolor='dark', thresh_channel=None, thresh=None)
  • v3.3之后: analysis_image = plantcv.report_size_marker_area(img, roi_contour, roi_hierarchy, marker='define', objcolor='dark', thresh_channel=None, thresh=None)

plantcv.resize

  • v3.0dev2之前: device, reimg = plantcv.resize(img, resize_x, resize_y, device, debug=None)
  • v3.0dev2之后: reimg = plantcv.resize(img, resize_x, resize_y)

plantcv.rgb2gray

  • v3.0dev2之前: device, gray = plantcv.rgb2gray(img, device, debug=None)
  • v3.0dev2之后: gray = plantcv.rgb2gray(rgb_img)

plantcv.rgb2gray_hsv

  • v3.0dev2之前: device, gray = plantcv.rgb2gray_hsv(img, channel, device, debug=None)
  • v3.0dev2之后: gray = plantcv.rgb2gray_hsv(rgb_img, channel)

plantcv.rgb2gray_lab

  • v3.0dev2之前: device, gray = plantcv.rgb2gray_lab(img, channel, device, debug=None)
  • v3.0dev2之后: gray = plantcv.rgb2gray_lab(rgb_img, channel)

plantcv.roi.circle

  • v3.0dev之前1: NA
  • v3.0dev2之后: roi_contour, roi_hierarchy = plantcv.roi.circle(x, y, r, img)
  • v3.2之后: roi_contour, roi_hierarchy = plantcv.roi.circle(img, x, y, r)

plantcv.roi.ellipse

  • v3.0dev之前1: NA
  • v3.0dev2之后: roi_contour, roi_hierarchy = plantcv.roi.ellipse(x, y, r1, r2, angle, img)
  • v3.2之后: roi_contour, roi_hierarchy = plantcv.roi.ellipse(img, x, y, r1, r2, angle)

plantcv.roi.from_binary_image

  • v3.0dev之前1: NA
  • v3.0dev2之后: roi_contour, roi_hierarchy = plantcv.roi.from_binary_image(bin_img, img)
  • v3.2之后: roi_contour, roi_hierarchy = plantcv.roi.from_binary(img, bin_img)

plantcv.roi.rectangle

  • v3.0dev之前1: NA
  • v3.0dev2之后: roi_contour, roi_hierarchy = plantcv.roi.rectangle(x, y, h, w, img)
  • v3.2之后: roi_contour, roi_hierarchy = plantcv.roi.rectangle(img, x, y, h, w)

plantcv.roi.roi2mask

  • v3.8之前: NA
  • v3.8之后: mask = pcv.roi.roi2mask(img, contour)

plantcv.roi.multi

  • v3.1之前: NA
  • v3.1之后: roi_contours, roi_hierarchies = plantcv.roi.multi(img, coord, radius, spacing=None, nrows=None, ncols=None)

plantcv.roi_objects

  • v3.0dev2之前: device, kept_cnt, hierarchy, mask, obj_area = plantcv.roi_objects(img, roi_type, roi_contour, roi_hierarchy, object_contour, obj_hierarchy, device, debug=None)
  • v3.0dev2之后: kept_cnt, hierarchy, mask, obj_area = plantcv.roi_objects(img, roi_type, roi_contour, roi_hierarchy, object_contour, obj_hierarchy)
  • v3.3之后: kept_cnt, hierarchy, mask, obj_area = plantcv.roi_objects(img, roi_contour, roi_hierarchy, object_contour, obj_hierarchy,roi_type='partial')

plantcv.rotate

  • v3.0dev2之前: device, rotated_img = plantcv.rotate(img, rotation_deg, crop, device, debug=None)
  • v3.0dev2之后: rotated_img = plantcv.rotate(img, rotation_deg, crop)

plantcv.rotate_img

  • v3.0dev2之前: device, rotated_img = plantcv.rotate_img(img, rotation_deg, device, debug=None)
  • v3.0dev2之后: Deprecated, see:
    • rotated_img = plantcv.rotate(img, rotation_deg, crop)

plantcv.scale_features

  • v3.0dev2之前: device, rescaled, centroid_scaled, boundary_line_scaled = plantcv.scale_features(obj, mask, points, boundary_line, device, debug=None)
  • v3.0dev2之后: rescaled, centroid_scaled, boundary_line_scaled = plantcv.scale_features(obj, mask, points, boundary_line)
  • v3.2之后: rescaled, centroid_scaled, boundary_line_scaled = plantcv.scale_features(obj, mask, points, line_position)

plantcv.scharr_filter

  • v3.0dev2之前: device, sr_img = plantcv.scharr_filter(img, dX, dY, scale, device, debug=None)
  • v3.0dev2之后: sr_img = plantcv.scharr_filter(gray_img, dx, dy, scale)

plantcv.shift_img

  • v3.0dev2之前: device, adjusted_img = plantcv.shift_img(img, device, number, side="right", debug=None)
  • v3.0dev2之后: adjusted_img = plantcv.shift_img(img, number, side="right")

plantcv.sobel_filter

  • v3.0dev2之前: device, sb_img = plantcv.sobel_filter(img, dx, dy, k, device, debug=None)
  • v3.0dev2之后: sb_img = plantcv.sobel_filter(gray_img, dx, dy, k)
  • v3.2之后: sb_img = plantcv.sobel_filer(gray_img, dx, dy, ksize)

plantcv.spectral_index.ndvi(hsi, distance=20)

  • v3.8之后: array = plantcv.spectral_index.ndvi(hsi, distance=20)

plantcv.spectral_index.gdvi(hsi, distance=20)

  • v3.8之后: array = plantcv.spectral_index.gdvi(hsi, distance=20)

plantcv.spectral_index.savi(hsi, distance=20)

  • v3.8之后: array = plantcv.spectral_index.savi(hsi, distance=20)

plantcv.spectral_index.pri(hsi, distance=20)

  • v3.8之后: array = plantcv.spectral_index.pri(hsi, distance=20)

plantcv.spectral_index.ari(hsi, distance=20)

  • v3.8之后: array = plantcv.spectral_index.ari(hsi, distance=20)

plantcv.spectral_index.ci_rededge(hsi, distance=20)

  • v3.8之后: array = plantcv.spectral_index.ci_rededge(hsi, distance=20)

plantcv.spectral_index.cri550(hsi, distance=20)

  • v3.8之后: array = plantcv.spectral_index.cri550(hsi, distance=20)

plantcv.spectral_index.cri700(hsi, distance=20)

  • v3.8之后: array = plantcv.spectral_index.cri700(hsi, distance=20)

plantcv.spectral_index.egi(rgb_img)

  • v3.8之后: array = plantcv.spectral_index.egi(rgb_img)

plantcv.spectral_index.evi(hsi, distance=20)

  • v3.8之后: array = plantcv.spectral_index.evi(hsi, distance=20)

plantcv.spectral_index.mari(hsi, distance=20)

  • v3.8之后: array = plantcv.spectral_index.mari(hsi, distance=20)

plantcv.spectral_index.mcari(hsi, distance=20)

  • v3.8之后: array = plantcv.spectral_index.mcari(hsi, distance=20)

plantcv.spectral_index.mtci(hsi, distance=20)

  • v3.8之后: array = plantcv.spectral_index.mtci(hsi, distance=20)

plantcv.spectral_index.ndre(hsi, distance=20)

  • v3.8之后: array = plantcv.spectral_index.ndre(hsi, distance=20)

plantcv.spectral_index.psnd_chla(hsi, distance=20)

  • v3.8之后: array = plantcv.spectral_index.psnd_chla(hsi, distance=20)

plantcv.spectral_index.psnd_chlb(hsi, distance=20)

  • v3.8之后: array = plantcv.spectral_index.psnd_chlb(hsi, distance=20)

plantcv.spectral_index.psnd_car(hsi, distance=20)

  • v3.8之后: array = plantcv.spectral_index.psnd_car(hsi, distance=20)

plantcv.spectral_index.psri(hsi, distance=20)

  • v3.8之后: array = plantcv.spectral_index.psri(hsi, distance=20)

plantcv.spectral_index.pssr_chla(hsi, distance=20)

  • v3.8之后: array = plantcv.spectral_index.pssr_chla(hsi, distance=20)

plantcv.spectral_index.pssr_chlb(hsi, distance=20)

  • v3.8之后: array = plantcv.spectral_index.pssr_chlb(hsi, distance=20)

plantcv.spectral_index.pssr_car(hsi, distance=20)

  • v3.8之后: array = plantcv.spectral_index.pssr_car(hsi, distance=20)

plantcv.spectral_index.rgri(hsi, distance=20)

  • v3.8之后: array = plantcv.spectral_index.rgri(hsi, distance=20)

plantcv.spectral_index.rvsi(hsi, distance=20)

  • v3.8之后: array = plantcv.spectral_index.rvsi(hsi, distance=20)

plantcv.spectral_index.sipi(hsi, distance=20)

  • v3.8之后: array = plantcv.spectral_index.sipi(hsi, distance=20)

plantcv.spectral_index.sr(hsi, distance=20)

  • v3.8之后: array = plantcv.spectral_index.sr(hsi, distance=20)

plantcv.spectral_index.vari(hsi, distance=20)

  • v3.8之后: array = plantcv.spectral_index.vari(hsi, distance=20)

plantcv.spectral_index.vi_green(hsi, distance=20)

  • v3.8之后: array = plantcv.spectral_index.vi_green(hsi, distance=20)

plantcv.spectral_index.wi(hsi, distance=20)

  • v3.8之后: array = plantcv.spectral_index.wi(hsi, distance=20)

plantcv.stdev_filter

  • v3.9之前: NA
  • v3.9之后: filtered_img = plantcv.stdev_filter(img, kszie, borders="nearest")

plantcv.threshold.binary

  • v3.0dev2之前: NA
  • v3.0dev2之后: bin_img = plantcv.threshold.binary(gray_img, threshold, max_value, object_type="light")

plantcv.threshold.custom_range

  • v3.3之前: NA
  • v3.3之后: mask, masked_img = plantcv.threshold.custom_range(rgb_img, lower_thresh, upper_thresh, channel='RGB')**
  • v3.8之后: mask, masked_img = plantcv.threshold.custom_range(img, lower_thresh, upper_thresh, channel='RGB')**

plantcv.threshold.gaussian

  • v3.0dev2之前: NA
  • v3.0dev2之后: bin_img = plantcv.threshold.gaussian(gray_img, max_value, object_type="light")

plantcv.threshold.mean

  • v3.0dev2之前: NA
  • v3.0dev2之后: bin_img = plantcv.threshold.mean(gray_img, max_value, object_type="light")

plantcv.threshold.otsu

  • v3.0dev2之前: NA
  • v3.0dev2之后: bin_img = plantcv.threshold.otsu(gray_img, max_value, object_type="light")

plantcv.threshold.saturation

  • v3.8之前: NA
  • v3.8之后: bin_img = plantcv.threshold.saturation(*rgb_img, threshold=255, channel="any")

plantcv.threshold.texture_filter

  • v3.0之前: NA
  • v3.0之后: bin_img = plantcv.threshold.texture_filter(gray_img, ksize, threshold, offset=3, texture_method='dissimilarity', borders='nearest', max_value=255)

plantcv.threshold.triangle

  • v3.0dev2之前: NA
  • v3.0dev2之后: bin_img = plantcv.threshold.triangle(gray_img, max_value, object_type="light", xstep=1)

plantcv.transform.apply_transformation_matrix

  • v3.0dev之前1: NA
  • v3.0dev2之后: corrected_img = plantcv.transform.apply_transformation_matrix(source_img, target_img, transformation_matrix)

plantcv.transform.calc_transformation_matrix

  • v3.0dev之前1: NA
  • v3.0dev2之后: determinant, transformation_matrix = plantcv.transform.calc_transformation_matrix(matrix_m, matrix_b)

plantcv.transform.correct_color

  • v3.0dev之前1: NA
  • v3.0dev2之后: target_matrix, source_matrix, transformation_matrix, corrected_img = plantcv.transform.correct_color(target_img, target_mask, source_img, source_mask, output_directory)

plantcv.transform.create_color_card_mask

  • v3.0之前: NA
  • v3.0之后: mask = pcv.transform.create_color_card_mask(rgb_img, radius, start_coord, spacing, nrows, ncols, exclude=[])

plantcv.transform.find_color_card

  • v3.0之前: NA
  • v3.0之后: df, start_coord, spacing = plantcv.transform.find_color_card(rgb_img, threshold='adaptgauss', threshvalue=125, blurry=False, background='dark')
  • v3.3之后: df, start_coord, spacing = plantcv.transform.find_color_card(rgb_img, threshold_type='adaptgauss', threshvalue=125, blurry=False, background='dark')
  • v3.9之后: df, start_coord, spacing = plantcv.transform.find_color_card(rgb_img, threshold_type='adaptgauss', threshvalue=125, blurry=False, background='dark', record_chip_size='median')

plantcv.transform.get_color_matrix

  • v3.0dev之前1: NA
  • v3.0dev2之后: headers, color_matrix = plantcv.transform.get_color_matrix(rgb_img, mask)

plantcv.transform.get_matrix_m

  • v3.0dev之前1: NA
  • v3.0dev2之后: matrix_a, matrix_m, matrix_b = plantcv.transform.get_matrix_m(target_matrix, source_matrix)

plantcv.transform.load_matrix

  • v3.0dev之前1: NA
  • v3.0dev2之后: matrix = plantcv.transform.load_matrix(filename)

plantcv.transform.nonuniform_illumination

  • v3.5之前: NA
  • v3.5之后: corrected_img = plantcv.transform.nonuniform_illumination(img, ksize)

plantcv.transform.quick_color_check

  • v3.0之前: NA
  • v3.0之后: plantcv.transform.quick_color_check(target_matrix, source_matrix, num_chips)

plantcv.transform.save_matrix

  • v3.0dev之前1: NA
  • v3.0dev2之后: plantcv.transform.save_matrix(matrix, filename)

plantcv.triangle_auto_threshold

  • v3.0dev2之前: device, bin_img = plantcv.triangle_auto_threshold(device, img, maxvalue, object_type, xstep=1, debug=None)
  • v3.0dev2之后: Deprecated, see:
    • bin_img = plantcv.threshold.triangle(gray_img, max_value, object_type="light", xstep=1)

plantcv.visualize.colorize_masks

  • v3.2之前: NA
  • v3.2之后: colored_img = pcv.visualize.colorize_masks(classes, colors)

plantcv.visualize.colorspaces

  • v3.8之前: NA
  • v3.8之后: plotting_img = pcv.visualize.colorspaces(rgb_img)

plantcv.visualize.histogram

  • v3.2之前: bins, hist = plantcv.plot_hist(img, name=False)
  • v3.2之后: hist_header, hist_data, fig_hist = plantcv.visualize.histogram(gray_img, mask=None, bins=256)
  • v3.3之后: hist_header, hist_data, fig_hist = plantcv.visualize.histogram(gray_img, mask=None, bins=256, color='red', title=None)
  • v3.5之后: fig_hist = plantcv.visualize.histogram(gray_img, mask=None, bins=256, color='red', title=None)

plantcv.visualize.pseudocolor

  • v3.2之前: pseudo_img = plantcv.pseudocolor(gray_img, obj=None, mask=None, cmap=None, background="image", min_value=0, max_value=255, dpi=None, axes=True, colorbar=True)
  • v3.2之后: pseudo_img = plantcv.visualize.pseudocolor(gray_img, obj=None, mask=None, cmap=None, background="image", min_value=0, max_value=255, dpi=None, axes=True, colorbar=True)
  • v3.3之后: pseudo_img = plantcv.visualize.pseudocolor(gray_img, obj=None, mask=None, cmap=None, background="image", min_value=0, max_value=255, axes=True, colorbar=True)

plantcv.watershed_segmentation

  • v3.0dev2之前: device, watershed_header, watershed_data, analysis_images = plantcv.watershed_segmentation(device, img, mask, distance=10, filename=False, debug=None)
  • v3.0dev2之后: watershed_header, watershed_data, analysis_images = plantcv.watershed_segmentation(rgb_img, mask, distance=10, filename=False)
  • v3.1之后: watershed_header, watershed_data, analysis_images = plantcv.watershed_segmentation(rgb_img, mask, distance=10)
  • v3.3之后: analysis_image = plantcv.watershed_segmentation(rgb_img, mask, distance=10)

plantcv.white_balance

  • v3.0dev2之前: device, finalcorrected = plantcv.white_balance(device, img, mode='hist',debug=None, roi=None)
  • v3.0dev2之后: finalcorrected = plantcv.white_balance(img, mode='hist', roi=None)

plantcv.within_frame

  • v3.3之前: NA
  • v3.3之后: in_bounds = plantcv.within_frame(mask)
  • v3.8之后: in_bounds = plantcv.within_frame(mask, border_width=1)

plantcv.x_axis_pseudolandmarks

  • v3.0dev2之前: device, top, bottom, center_v = plantcv.x_axis_pseudolandmarks(obj, mask, img, device, debug=None)
  • v3.0dev2之后: top, bottom, center_v = plantcv.x_axis_pseudolandmarks(obj, mask, img)
  • v3.2之后: top, bottom, center_v = plantcv.x_axis_pseudolandmarks(img, obj, mask)

plantcv.y_axis_pseudolandmarks

  • v3.0dev2之前: device, left, right, center_h = plantcv.y_axis_pseudolandmarks(obj, mask, img, device, debug=None)
  • v3.0dev2之后: left, right, center_h = plantcv.y_axis_pseudolandmarks(obj, mask, img)
  • v3.2之后: left, right, center_h = plantcv.y_axis_pseudolandmarks(img, obj, mask)
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 202,723评论 5 476
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 85,080评论 2 379
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 149,604评论 0 335
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,440评论 1 273
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,431评论 5 364
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,499评论 1 281
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 37,893评论 3 395
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,541评论 0 256
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 40,751评论 1 296
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,547评论 2 319
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,619评论 1 329
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,320评论 4 318
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 38,890评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,896评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,137评论 1 259
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 42,796评论 2 349
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,335评论 2 342