我想在16位图像上使用非锐化掩模.图像具有640 x 480像素,并保存在numpy数组中.在第一步中,我使用高斯滤波器(三种不同的方法)模糊图像.在此之后,我通过从原始图形中减去模糊图像来创建蒙版.在最后一步,我将面具乘以wightfaktor添加到原始图像.但它并没有真正奏效.
这是Python代码:
Gaussian1 = ndimage.filters.gaussian_filter(Image,sigma=10.0)
Gaussian2 = filters.gaussian_filter(Image,sigma=10.0)
Gaussian3 = cv2.GaussianBlur(Image,(9,9),sigmaX=10.0)
Mask1 = Image - Gaussian1
UnsharpImage = Image + (WightFaktor*Mask1)
Run Code Online (Sandbox Code Playgroud)
愿有人帮助我吗?
我正在使用seaborn包在Python中绘制热图.我绘制值是离散的,他们是整数-1,0和1.
我希望热图中的单元格-1显示绿色,0黄色显示1为红色,红色显示为绿色.
是否可以在cubehelix_palette()或colour_palette()函数中指定此裁定?
I am trying to save an existing Excel file to HTML in Python using win32com.client. Below is my code and the resulting error message. Any suggestions?
import win32com.client as win32
excel = win32.gencache.EnsureDispatch('Excel.Application')
wb = excel.Workbooks.Open(r'D:\eclipse\test.xlsx')
excel.Visible = True
ws = wb.Worksheets('Sheet1')
ob = wb.PublishObjects.Add(1,'C:\test.html','Sheet1')
ob.Publish(True)
Run Code Online (Sandbox Code Playgroud)
With the following Traceback:
Traceback (most recent call last):
File "D:\eclipse\DMS\AGADMS\exceltohtml.py", line 21, in <module>
ob = wb.PublishObjects.Add(1,'C:\test.html')
File "C:\Python34\lib\site-packages\win32com\gen_py\00020813-0000-0000-C000-000000000046x0x1x7\PublishObjects.py", line 37, in Add
, Title)
pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, None, None, …Run Code Online (Sandbox Code Playgroud) 我有两个xlsx文件如下:
value1 value2 value3
0.456 3.456 0.4325436
6.24654 0.235435 6.376546
4.26545 4.264543 7.2564523
Run Code Online (Sandbox Code Playgroud)
和
value1 value2 value3
0.456 3.456 0.4325436
6.24654 0.23546 6.376546
4.26545 4.264543 7.2564523
Run Code Online (Sandbox Code Playgroud)
我需要比较所有细胞,以及来自file1 !=细胞的细胞file2 print.
import xlrd
rb = xlrd.open_workbook('file1.xlsx')
rb1 = xlrd.open_workbook('file2.xlsx')
sheet = rb.sheet_by_index(0)
for rownum in range(sheet.nrows):
row = sheet.row_values(rownum)
for c_el in row:
print c_el
Run Code Online (Sandbox Code Playgroud)
如何添加的比较电池file1和file2?
我有一个nginx服务器正在运行.我想向公司代理发出一些请求并将结果返回给客户端.
让我们说客户端发出请求http://ip:port/redirect/google.com,服务器应该以https://username:password@ip_proxy请求的url作为参数发出请求.
我发现了一些与我的问题相近的问题:
http://serverfault.com/questions/732063/nginx-proxy-pass-reverse-proxying-behind-corporate-firewall
和
http://stackoverflow.com/questions/11865119/how-to-configure-nginx-behind-a-corporate-proxy
假设205.100.100.100:80是代理URI和代理
XXVzYTQzMjXXXDpCb25qXXyMQ==的凭证
一说我们应该重写url然后将其传递给proxy_pass指令
location ^~ /redirect/ {
rewrite ^/redirect/(.*) https://google.com;
proxy_pass_header on;
proxy_set_header Proxy-Authorization "XXVzYTQzMjXXXDpCb25qXXyMQ==";
proxy_pass https://205.100.100.100:80;
}
Run Code Online (Sandbox Code Playgroud)
我认为它不能正常工作,因为它显示为重定向(http代码301)
另一个说我们应该使用Host头并用它指定原始url:
location ^~ /redirect/ {
proxy_pass_header on;
proxy_set_header Host "https://google.com";
proxy_set_header Proxy-Authorization "XXVzYTQzMXXXpCb25XXyMQ==";
proxy_pass https://205.100.100.100:80;
}
Run Code Online (Sandbox Code Playgroud)
不行.他们还说代理读取指定为url参数的url类似于:http://proxy:port/url_requestedso:
location /redirect {
rewrite ^/redirect/(.*)"http://205.100.100.100:80/https://google.com" break;
proxy_pass_header on;
proxy_set_header Proxy-Authorization "XXVzYTQzMXXXpCb25XXyMQ==";
proxy_pass http://corporate-proxy.mycorp.com:8080;
}
Run Code Online (Sandbox Code Playgroud)
应该管用 ?
如您所见,我不知道如何指定代理的用户名,密码.我尝试了一个没有结果的Proxy-Authorization标题"XXVzYTQzMjXXXDpCb25qXXyMQ==".
我也尝试了http_upstream模块,没有结果.我无法使用,proxy_pass http://user:pwd@205.100.100.100:80因为nginx使用":"来解析端口,它给了我指定端口的错误.
我该怎么办?
也许它来自整个配置或他们使用代理的方式?不知道.
如何在考虑时间复杂度的情况下,找到从10到20亿之间有6个类似(23,29)的连续质数对的数量(使用任何编程语言,而无需使用任何外部库)?
尝试过eratosthenes的筛子,但要获得连续的素数是挑战
使用过的发电机,但时间复杂度很高
代码是:
def gen_numbers(n):
for ele in range(1,n+1):
for i in range(2,ele//2):
if ele%i==0:
break
else:
yield ele
prev=0
count=0
for i in gen_numbers(2000000000):
if i-prev==6:
count+=1
prev = i
Run Code Online (Sandbox Code Playgroud) 有人可以告诉我,哪里可以将一些数据隐藏到PDF文件中?换句话说,隐藏在PDF文件中.有没有算法可以做到这一点?
我有一个报告要自动提交,我使用matplotlib来做到这一点.但我无法弄清楚如何在开始时使用标题创建一个空白页面,分析类型
with PdfPages('review_count.pdf') as pdf:
for cat in self.cat_vars.keys():
if len(self.cat_vars[cat]) > 1:
plt.figure()
self.cat_vars[cat].plot(kind='bar')
plt.title(cat)
# saves the current figure into a pdf page
pdf.savefig()
plt.close()
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 Python 的xmlrpclib. 我已经知道如何更新现有页面的内容,但如何创建一个全新的页面?
我使用以下脚本来更新内容:
import xmlrpclib
CONFLUENCE_URL='https://wiki.*ownURL*/rpc/xmlrpc'
def update_confluence(user, pwd, pageid, newcontent):
client = xmlrpclib.Server(CONFLUENCE_URL,verbose=0)
authToken=client.confluence2.login(user,pwd)
page = client.confluence2.getPage(authToken, pageid)
page['content'] = newcontent
cient.confluence2.storePage(authToken, page)
client.confluence2.logout(authToken)
Run Code Online (Sandbox Code Playgroud)
这在更新内容时效果很好。但问题是,pageID在创建新页面时我需要以某种方式解决,但我不知道该怎么做。
有没有其他方法可以创建新页面?
python ×7
excel ×2
algorithm ×1
bounce ×1
compare ×1
confluence ×1
file ×1
file-format ×1
gaussian ×1
heatmap ×1
math ×1
matplotlib ×1
native ×1
nginx ×1
numpy ×1
opencv ×1
pandas ×1
pdf ×1
pdfpages ×1
primes ×1
react-native ×1
reactjs ×1
scrollview ×1
seaborn ×1
xlrd ×1