コード例 #1
0
ファイル: test.py プロジェクト: ipbs/ipbs
def runtest(test):
  p = subprocess.Popen(test, shell=True)
  retval = p.wait()
  return retval
コード例 #2
0
ファイル: test.py プロジェクト: ipbs/ipbs
def checkmsh(meshname):
  p = subprocess.Popen('[ -f grids/' + str(meshname) + '.msh ]', shell=True)
  if p.wait() == 0:
    p = subprocess.Popen('[ grids/' + str(meshname) + '.geo -ot grids/' + str(meshname) + '.msh ]', shell=True)
    return p.wait()
  else: return 1
コード例 #3
0
ファイル: test.py プロジェクト: ipbs/ipbs
def domesh(meshname):
  p = subprocess.Popen('gmsh -2 $(pwd)/grids/' + str(meshname) + '.geo ]', shell=True)
  retval = p.wait()
  return retval
コード例 #4
0
from skimage.color import rgb2gray
import numpy as np
import cv2
import matplotlib.pyplot as plt
from scipy import ndimage

image = plt.imread('../images/subabul.jpg')
image.shape
plt.imshow(image)
plt.show(image)
plt.wait(0)

gray = rgb2gray(image)
plt.imshow(gray, cmap='gray')

gray = rgb2gray(image)
gray_r = gray.reshape(gray.shape[0] * gray.shape[1])
for i in range(gray_r.shape[0]):
    if gray_r[i] > gray_r.mean():
        gray_r[i] = 3
    elif gray_r[i] > 0.5:
        gray_r[i] = 2
    elif gray_r[i] > 0.25:
        gray_r[i] = 1
    else:
        gray_r[i] = 0
gray = gray_r.reshape(gray.shape[0], gray.shape[1])
plt.imshow(gray, cmap='gray')